#include <reg52.h>
#define DataPort P0 //定义数据端口
sbit LATCH_Seg = P2^2;//定义锁存使能端口,段锁存
sbit LATCH_Bit = P2^3;// 位
unsigned char DuanMa[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
unsigned char WeiMa[] ={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char sec;
//unsigned char i;
void delay(unsigned int t);
void ISR_T0(void);
/*void Delay_1s()//50*20
{
int t;
TMOD = 0x01;
for(t=0;t<20;t++)
{
TH0 = 0x3c;//高位
TL0 = 0xb0;//低位
TR0 = 1;//开关
while(!TF0);//标志位(溢出)
TF0 = 0;
}
}*/
void timer_init()
{
TH0 = 0x3c;//高位
TL0 = 0xb0;//低位
}
void main(void)
{
int i;
// int num;
TMOD = 0x01;
Timer_init();
TR0 = 1;//开关
//while(!TF0);//标志位(溢出)
//TF0 = 0;
// num = 0;
EA = 1;//总开关
ET0 = 1;//外部中断开
数码管
最新推荐文章于 2024-08-18 20:17:06 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)