求助led灯,数码管的点亮和led点阵
答案:1 悬赏:80 手机版
解决时间 2021-04-01 07:51
- 提问者网友:容嬷嬷拿针来
- 2021-03-31 13:14
求助led灯,数码管的点亮和led点阵
最佳答案
- 五星知识达人网友:有你哪都是故乡
- 2021-03-31 13:47
#include
char code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//共阳级数码管码表0-9
sbit led1=P1^0;
sbit led2=P1^1;
sbit led3=P1^2;
sbit key1=P1^4;
sbit key2=P1^5;
sbit key3=P1^6;
main()
{
while(1)
{
if(key1==0)
{
while(key1==0);
P0=table[1];
led1=0;led2=1;led3=1;
}
if(key2==0)
{
while(key2==0);
P0=table[2];
led1=1;led2=0;led3=1;
}
if(key3==0)
{
while(key3==0);
P0=table[3];
led1=1;led2=1;led3=0;
}
}
}
char code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//共阳级数码管码表0-9
sbit led1=P1^0;
sbit led2=P1^1;
sbit led3=P1^2;
sbit key1=P1^4;
sbit key2=P1^5;
sbit key3=P1^6;
main()
{
while(1)
{
if(key1==0)
{
while(key1==0);
P0=table[1];
led1=0;led2=1;led3=1;
}
if(key2==0)
{
while(key2==0);
P0=table[2];
led1=1;led2=0;led3=1;
}
if(key3==0)
{
while(key3==0);
P0=table[3];
led1=1;led2=1;led3=0;
}
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯