/*代码你可以参考一下,晶振按11.059200MHz写的。
提示一下,按你这仿真是不能做实物的,要加上限流电阻*/
#include "reg52.h"
unsigned char code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff}; //共阳数码管段选
void main()
{
TMOD = 0x01;
TH0 = 0xFC;
TL0 = 0x66;
EA = 1;
ET0 = 1;
TR0 = 1;
while(1);
}
void Timer0Interrupt(void) interrupt 1
{
static unsigned int i = 0;
static char time = 60;
TH0 = 0xFC;
TL0 = 0x66;
P3 = table[time%10];
P2 = table[time/10];
i++;
if (i >= 1000)
{
i = 0;
time--;
if (time < 0)
{
time = 60;
}
}
}
追问谢谢么么哒
不做实物,只仿真