標(biāo)題:
數(shù)碼管動態(tài)顯示
[打印本頁]
作者:
huyun
時間:
2015-6-5 00:32
標(biāo)題:
數(shù)碼管動態(tài)顯示
電路圖詳見:
http://www.torrancerestoration.com/f/51hei-5.pdf
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit wexu=P2^7;
sbit duxu=P2^6;
uchar numdu,numwe,a,b,c;
uchar code tabledu[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar code tablewe[]={
0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
void main()
{
EA=1;
ET0=1;
TMOD=0X01;
TH0=(65536-500)/256;
TL0=(65536-500)%256;
TR0=1;
numdu=1;
numwe=0;
while(1)
{
if(a==1)
{
a=0;
wexu=1;
P0=tablewe[numwe];
wexu=0;
numwe++;
if(numwe==6)
numwe=0;
duxu=1;
P0=tabledu[numdu];
duxu=0;
numdu++;
if(numdu==7)
numdu=1;
}
}
}
void timer0() interrupt 1
{
TH0=(65536-1)/256;
TL0=(65536-1)%256;
a++;
}
作者:
amchina
時間:
2015-6-21 16:49
51學(xué)習(xí)版的數(shù)碼管動態(tài)有些麻煩,干其它工作時間長了,就閃爍了。
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1