#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
uchar code tab[]={
0xc0,0xf9,0xa4,0xb0,
0x99,0x92,0x82,0xf8,
0x80,0x90,0x88,0x83,
0xc6,0xa1,0x86,0x8e};
uchar temp,bai,shi,ge,aa,flag,flag1,t0,t1;
uint shu;
void display(uchar aa,uchar bai,uchar shi,uchar ge);
void init();
void delay(uint z);
void main()
{
init();
while(1)
{
if(flag1!=1)
display(6,bai,shi,ge);
else
display(6,6,6,6);
}
}
void init()
{
shu=432;
temp=0xfe;
P1=temp;
TMOD=0x11;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
ET1=1;
TR1=1;
}
void time1() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
t1++;
if(t1==2)
{
t1=0;
bai=shu/100;
shi=shu%10
用定时器1控制四位数码管从6432减到6393保持住这个数值,同时用定时器0控制流水灯从上至下以500ms移动同时停止!!!然后流水灯全部闪烁2.4秒后熄灭!继而数码管上显示6666
最新推荐文章于 2022-12-27 13:19:48 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)