標題:
求解 通過AT89C51的定時器實現(xiàn).60S倒計時,顯示采用兩位數(shù)碼管動態(tài)顯示
[打印本頁]
作者:
misterou
時間:
2013-11-25 22:34
標題:
求解 通過AT89C51的定時器實現(xiàn).60S倒計時,顯示采用兩位數(shù)碼管動態(tài)顯示
通過AT89C51的定時器實現(xiàn).60S倒計時,顯示采用兩位數(shù)碼管動態(tài)顯示。用C語言寫
作者:
kid次
時間:
2013-11-26 01:49
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar code LED_W[8] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(uint i)
{
uint x,j;
for(j=0;j<i;j++)
for(x=0;x<=148;x++);
}
void display(uint temp)
{
P0=0;
P2=0xfb;
P0=table[temp/100];
delay(2);
P0=0;
P2=0xfd;
P0=table[temp%100/10];
P0=P0 | 0x80;
delay(2);
P0=0;
P2=0xfe;
P0=table[temp%10];
delay(2);
}
void main()
{
uint i=100,j;
while(1)
{ if(i!=0)
{
for(j=0;j<10;j++)
{
display(i);
}
i--;
}
else
{
while(1)
{ uint i;
for(i=0;i<10;i++)
{P2=0xfe;
P0=0x3f;
delay(2);
P2=0xfd;
P0=0x3f;
delay(2);
P2=0xfb;
P0=0x3f;
delay(2);}
P2=0xff;
delay(200);
}
}
}
}
你自己參考一下吧
作者:
xiaoou
時間:
2013-11-26 03:21
還是版主牛逼這么快就搞定了
作者:
liuzhaoxin1020
時間:
2016-12-17 11:49
厲害,值得參考
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1