標(biāo)題:
四位顯示的頻率計(jì),帶proteus仿真
[打印本頁(yè)]
作者:
tzrdcaabb
時(shí)間:
2018-11-7 22:14
標(biāo)題:
四位顯示的頻率計(jì),帶proteus仿真
四位顯示的頻率計(jì),帶proteus仿真
0.png
(91.31 KB, 下載次數(shù): 45)
下載附件
2018-11-14 02:02 上傳
單片機(jī)源程序如下:
#include <reg52.h>
unsigned char code dispbit[]={0xef,0xdf,0xbf,0x7f};
unsigned char code dispcode[]={0xc0,0Xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char dispbuf[4]={0,0,0,0};
unsigned char temp[8];
unsigned char dispcount;
unsigned char T0count;
unsigned char timecount;
bit flag;
unsigned long x;
void main(void)
{
unsigned char i;
TMOD=0x15;
TH0=0;
TL0=0;
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
TR1=1;
TR0=1;
ET0=1;
ET1=1;
EA=1;
while(1)
{
if(flag==1)
{
flag=0;
x=T0count*65536+TH0*256+TL0;
for(i=0;i<4;i++)
{
temp[i]=0;
}
i=0;
while(x/10)
{
temp[i]=x%10;
x=x/10;
i++;
}
temp[i]=x;
for(i=0;i<4;i++)
{
dispbuf[i]=temp[i];
}
timecount=0;
T0count=0;
TH0=0;
TL0=0;
TR0=1;
}
}
}
void t0(void) interrupt 1 using 0
{
T0count++;
}
void t1(void) interrupt 3 using 0
{
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
timecount++;
if(timecount==250)
{
TR0=0;
timecount=0;
flag=1;
}
P0=dispcode[dispbuf[dispcount]];
P2=dispbit[dispcount];
dispcount++;
if(dispcount==4)
{
dispcount=0;
}
}
復(fù)制代碼
所有資料51hei提供下載:
046、四位頻率計(jì).zip
(101.26 KB, 下載次數(shù): 24)
2018-11-7 22:14 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
158925
時(shí)間:
2018-12-12 18:03
你的仿真數(shù)碼管都不亮,真的是牛皮,騙人的帖子活該你沉了
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1