用C语言编写一个在八个数码管上轮流显示1-8的程序

如题所述

我这个程序是在PROTUES仿真上做的 你可以根据程序自己画电路图 很简单的 这里用到了
两片 74HC573 芯片 显示0---F
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit duan=P1^6;
sbit wei=P1^7;
uchar temp=0x01;
uchar code tab[]={ 0xc0,0xf9,0xA4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
uchar a=0;
void delay(uint z);
void main()
{ while(1)
{ wei=1;P2=temp;wei=0;
duan=1;P2=tab[a];duan=0;
delay(300);
temp=_crol_(temp,1);
a++;
if(a==16){a=0;}} }
void delay(uint z)
{ uint x,y;
for(x=z;x>0;x--)
for(y=120;y>0;y--);}
温馨提示:答案为网友推荐,仅供参考
相似回答