基于单片机数码管电子钟设计-毕设资料
1480下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0
//#include <reg51.h> //# include <absacc.h> # include <STC12C5A60S2.h> # define uchar unsigned char # define uint unsigned int # define uint32 unsigned long int # define sint32 signed long int # define vtim1 50000 //定时50ms,一帧8*50=40ms,频率=40Hz # define vtim2 2500 //定时2.5ms,一帧8*2.5=20ms,频率=50Hz //# define vt DBYTE[0x21^0] # define vt ((unsigned char volatile data *) 0)[0x21^0] //sbit vt=0xe8; //数码管位选循环变量 uchar wi=0; //共阴数码管段码表 uchar code distable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0X40,0x00,0x31}; //位选码表 uchar code numi[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; //显示缓存 uchar V_ram[]={0x01,0x02,0x10,0x03,0x04,0x10,0x05,0x06}; sbit p32=P3^2; sbit p33=P3^3; uchar i=0; uchar j=0,k=0,ss=0; uchar x=0; uchar key_num=0xff; void main() { vt=1; vt=0; vt=1; IT0=0; IT1=0; EA=1; ET0=1;