求四位数码管单片机驱动程序!!!c程序!

2024-12-26 08:46:07
推荐回答(2个)
回答1:

#include
#include
#define uint unsigned int
#define uchar unsigned char

uchar temp,t;
uint num=0;
uchar code table[]={0x40,0xf9,0x24,0x30,0x19,0x12,0x02,0x78,0x00};
uchar wei=0x01,duan=0x00;
main()
{

TMOD=0X01;
TH0=(65536-20000)/256;
TL0=(65536-20000)%256;
EA=1;
ET0=1;
TR0=1;

void xianshi(uint x)
{
a=x/1000;
b=x/100%10;
c=x/10%10;
d=x%10;
}

for(;;)
{
P1=wei;
duan=table[num];
P2=duan;
}
}
void timer() interrupt 1
{
TH0=(65536-20000)/256;
TL0=(65536-20000)%256;
num++ ;
if(num%4==0)
num=0;

wei=_crol_(wei,1);
}

回答2:

哈,联系我