程序按下面两种方法都试一下:
1.
main()
{
init();//初始化
LED1 = 1; //RA5
LED2 = 1; //RA4
while(1){asm("clrwdt");}
}
2.
main()
{
while(1)
{
PORTA = 0b00110000;
asm("clrwdt ...
xymxym 发表于 2010-8-5 09:33
程序1:
#include
<pic.h>
#include <pic16630.h>
__CONFIG (CPROTECT & PWRTEN & BOREN & WDTEN &
MCLRDIS & INTOSCIO);
//__IDLOC (2010);
__EEPROM_DATA(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
#define LED1 RC5
#define LED2 RC4
#define LED3 RA5
#define LED4 RA4
//////////////////////////////////////
void Init_Sys()
{
ANSEL = 0x00;
IOCA
= 0x00;
TRISA = 0x08;
TRISC = 0x00;
PORTA = 0x00;
PORTC = 0x00;
LED1 = 0;
LED2 = 0;
LED3 = 0;
LED4 = 0;
}
///////////////////////////////////////////
main()
{
Init_Sys();//初始化
LED1 = 1;
//RC5
LED2 = 1;
//RC4
LED3 = 1;
//RA5
LED4 = 1;
//RA4
while(1){asm("clrwdt");}
}
结果1:如图1
程序2:
#include
<pic.h>
#include <pic16630.h>
__CONFIG (CPROTECT & PWRTEN & BOREN & WDTEN &
MCLRDIS & INTOSCIO);
//__IDLOC (2010);
__EEPROM_DATA(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
#define LED1 RC5
#define LED2 RC4
#define LED3 RA5
#define LED4 RA4
//////////////////////////////////////
void Init_Sys()
{
ANSEL = 0x00;
IOCA
= 0x00;
TRISA = 0x08;
TRISC = 0x00;
PORTA = 0x00;
PORTC = 0x00;
LED1 = 0;
LED2 = 0;
LED3 = 0;
LED4 = 0;
}
///////////////////////////////////////////
main()
{
Init_Sys();//初始化
LED1 = 1;
//RC5
LED2 = 1;
//RC4
LED4 = 1;
//RA4
LED3 = 1;
//RA5
while(1){asm("clrwdt");}
}
结果2:如图2
程序3:
#include <pic.h>
#include <pic16630.h>
__CONFIG (CPROTECT & PWRTEN & BOREN & WDTEN & MCLRDIS & INTOSCIO);
//__IDLOC (2010);
__EEPROM_DATA(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
#define LED1 RC5
#define LED2 RC4
#define LED3 RA5
#define LED4 RA4
//////////////////////////////////////
void Init_Sys()
{
ANSEL = 0x00;
IOCA = 0x00;
TRISA = 0x08;
TRISC = 0x00;
PORTA = 0x00;
PORTC = 0x00;
LED1 = 0;
LED2 = 0;
LED3 = 0;
LED4 = 0;
}
///////////////////////////////////////////
main()
{
Init_Sys();//初始化
LED1 = 1; //RC5
LED2 = 1; //RC4
PORTA = 0b00110000;
while(1){asm("clrwdt");}
}
结果3:如图3 |