如何用51单片机C程序控制数码管从9到0的显
答案:2 悬赏:30
解决时间 2021-11-15 10:35
- 提问者网友:枯希心
- 2021-11-14 20:18
如何用51单片机C程序控制数码管从9到0的显
最佳答案
- 二级知识专家网友:悲观垃圾
- 2021-11-14 20:54
#include<reg51.h>
#define uchar unsigned char
uchar table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f};
sbit rstkey=P2^2;
sbit speaker=P2^0;
void delay()//延时约400毫秒
{
uchar i,j;
for(i=0;i<200;i++)
for(j=0;j<250;j++);
}
main()
{
uchar i,key;
P2=0xff;
while(1)
{
i=9;
P1=table[i];
i--;
if(i>9)i=9;
delay();
}
}
#define uchar unsigned char
uchar table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f};
sbit rstkey=P2^2;
sbit speaker=P2^0;
void delay()//延时约400毫秒
{
uchar i,j;
for(i=0;i<200;i++)
for(j=0;j<250;j++);
}
main()
{
uchar i,key;
P2=0xff;
while(1)
{
i=9;
P1=table[i];
i--;
if(i>9)i=9;
delay();
}
}
全部回答
- 1楼网友:滚刀废物浮浪人
- 2021-11-14 21:38
#include
sbit k1=p1^0;
#define uint16 unsigned int
#define uchar unsigned char
uchar code shuzu[ ]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void delay()
{
uint16 i=1000;
while(i--);
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯