第一次用16F77写了一个简单的程序,烧片后不能运行...表现为led_1常亮(外接LED ) 请大侠指点....谢谢
#include <pic1677.h> #define _16C77
#define SLEEP() asm("sleep") #define NOP() asm("nop") #define clrwdt() asm("clrwdt")
#define uchar unsigned char #define uint unsigned int
#define led_1 RC7 #define led_2 RC6 #define out RC0 #define busy RE0 #define req RE1
void port_init() { TRISA = 0xFF; //ff; 0 out; 1 in TRISB = 0x00; TRISC = 0x3E; //fe "0011 1110" TRISD = 0x00; TRISE = 0x00; //df; }
void delay() { uint a,b;
for(a=4000;a>0;a--) { for(b=200;b>0;b--) { NOP();
} } }
main() { port_init(); while(1) { led_1=1; delay(); led_1=0; delay(); } }
|