【资源下载】下载地址如下:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl
#include<reg52.h> #define uchar unsigned char #define uint unsigned int #define T 100 sbit RES=P3^7; int S=0,M=30; uchar count=0,ct=0; uchar tab_d[10]={0X3F,0X06,0X5B,0X4F,0X66, //段码 0X6D,0X7D,0X07,0X7F,0X6F}; uchar tab_wei[8]={0xfe,0xfd,0xfb,0xf7, //位码 0xef,0xdf,0xbf,0x7f}; //延时函数 void delay(uint t) // tms { uchar i=0; while(t--) for(i;i<120;i++); } //数码管显示函数 void disp(uchar d,uchar x,uchar w) //d为段选,x为小数点,w为位选 { P2=0xff; //位码选择 只能先设置位码再设置段码