电路图
C语言程序
#include #define uint unsigned int
#define uchar unsigned char
//共阳数码管编码表
uchar code table[10] ={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
//函数声明
void delay(uint time); //延时函数
void display(uchar w); //
uchar getKey(); //读取键盘的数值
void delay0_5s();
void delay5s();
//主程序
void main()
{
uchar keyValue;
TMOD=0x10;
while(1)
{
keyValue = getKey(); //读取键盘值
display(keyValue); //数码管显示&LED亮灭
}
}
void delay(uint time)
{
uint i,j;
for(i = 0; i