- 25
- 0
- 约6.89千字
- 约 9页
- 2019-09-10 发布于江苏
- 举报
51单片机输入数字并数码管倒计时典型C语言代码
使用STC89C52RC单片机,外接数码管、蜂鸣器。改代码非常适合初学者学习借鉴。
#includereg51.h
#define uchar unsigned char
#define uint unsigned int
sbit dula=P0^0;
sbit wela=P0^1;
sbit p17=P0^3;
sbit p02=P0^2;
sbit p32=P3^2;
sbit p04=P0^4;
uchar count;
uint Sumnum;
uint circle,circle1;
uint time;
float top;//定义top为浮点型变量
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar temp,count;
uint bian,num,e,d,c,b,a;
void delay(uchar x)
{
uchar a1,b1;
for(a1=x;a10;a1--)
for(b1=200;b10;b1--);
}
void chaishu(uint sum1)
{
uint e1,b1,c1,d1;
e=sum1/10000
原创力文档

文档评论(0)