4 编写一个LED灯流水灯程序 #include #define D7 P1-0 #define D6 P1-1 #define D5 P1-2 #define D4 P1-3 Void led-init(void); Void led-test(void); Void wait(unsigned char wait); /*主函数 Void main (void) { Led-init(); While(1) { Led-test(); } } /*led初始化 Void led-init(void) { P1SEL&=-0xof; PLSIRL=0xof; D7=1, D6=1; D5=1; D4=1; } /*led闪烁函数 Void led-test(void) { D7=0 Halwait(250); D7=1; D6=0; Halwait(250); D6=1; D5=0; hawait(250); D5=1; D4=0; Halwait(250); D4=1; } /*延时函数 Void halwait (undigned char wait) { unsigned long large wait; If(wait==0) {return;] Largewait= 5 定时器1馍计数器模式控制LED闪烁 # include # define unchar unsighed char # define LED1 P1-0 # define LED2 P1-1 Uint counter=0; Unit TempFlag; 本文来源:https://www.wddqw.com/doc/daba92d887c24028905fc327.html