51单片机控制led灯点亮与熄灭答:// 51单片机控制八个发光二极管 左右循环。include<reg52.h> define uchar unsigned char define uint unsigned int unsigned char TAB[]= {0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff}; // 改变这里 LED 各种花样 uchar t...
单片机怎么实现一个开关控制八个灯按一下亮一个按答:用一个寄存器做变量就可以。假如按键是一个开个,接在P1.0,八个灯在P0,低电平灯亮 程序是这样的 MOV 30H ,#00 LOP :SETB P1.0 JNB P1.0, PRESS AJMP LOP PRESS:INC 30H MOV A,30H CJNE A,#9,L_NEXT MOV 30H,#1 L_NEXT:JNB P1.0,MOV A,30H CJNE A,#1 ,LED1...