8051
CC2540--IAR for8051 10.20.1
工程配置
1 #include <ioCC2540.h> 2 3 #define uchar unsigned char 4 #define uint unsigned int 5 6 #define D0 P1_0 7 #define D1 P1_1 8 9 void Delay_MS(uint mesc) 10 { 11 uint i,j; 12 for(i=0;i<mesc;i++) 13 for(j=0;j<255;j++); 14 } 15 16 void LedOff(uchar mode) 17 { 18 D0=mode; 19 D1=mode; 20 } 21 22 void LedInit() 23 { 24 P1DIR |=0X0F; 25 P1SEL &=~0X0F; 26 LedOff(0); 27 } 28 29 void main() 30 { 31 uchar i; 32 LedInit(); 33 while(1) 34 { 35 for(i=0;i<3;i++) 36 { 37 D0=1; 38 Delay_MS(200); 39 D0=0; 40 Delay_MS(200); 41 } 42 } 43 }