标签:led initial ++ time typedef color sign bsp col
1 #include <iocc2540.h> 2 3 typedef unsigned char uchar; 4 typedef unsigned int uint; 5 6 #define LED1 P1_0 7 8 void led_init(void) 9 { 10 P1DIR |= 0X01; 11 LED1 = 0; 12 } 13 14 void T1_init(void) 15 { 16 T1CTL = 0x0d; //128分频 17 T1STAT = 0x21; //选择0通道 18 } 19 20 void main(void) 21 { 22 //initialize hardware 23 led_init(); 24 T1_init(); 25 26 uchar count = 0; 27 while(1) 28 { 29 if(IRCON>0) 30 { 31 //进入中断 32 IRCON = 0; //进入中断,首先关闭中断 33 if (count++ >=2) 34 { 35 count = 0; //count清除 36 LED1 = ~LED1; 37 } 38 } 39 } 40 41 }
标签:led initial ++ time typedef color sign bsp col
原文地址:https://www.cnblogs.com/Blue-Moniter4/p/9709661.html