更新一个单个按键控制多种流水灯状态的教程,希望能帮助到大家~
所需元器件如下:
STC89C52RC芯片 *1
10K电阻 *2
100Ω电阻 *8
10uF 电解电容 *1
22pF 瓷片电容 *2
12MHz晶振 *1
按键 *2
LED灯 *8
代码如下:
#includereg52.h
#define uchar unsigned char
#define uint unsigned int
#define LED P1
sbit KEY=P3^0;
unsigned char code led_1[8]=
{0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,
1