1024手机基地看电影,午夜福利视频导航,国产精品福利在线一区,亚洲欧美日韩另类成人,在线观看午夜日本理论片,成年超爽免费网站,国产精品成人免费,精品动作一级毛片,成人免费观看网站,97精品伊人久久大香蕉
標題:
單片機任意定時的倒計時程序
[打印本頁]
作者:
chendechao
時間:
2017-6-7 16:07
標題:
單片機任意定時的倒計時程序
任意定時的倒計時
單片機源程序:
#include<reg52.h>
#define seatport P1
#define segport P0
int b;
int round;
unsigned char seatt[6]={0x1f,
0x2f,
0x37,
0x3b,
0x3d,
0x3e};
unsigned char segt[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void delayms(int s)
{
int i,j;
for(j=s;j>0;j--)
for(i=0;i<150;i++)
;
}
void converthsmandshow(int dat)
{
int h,s,m;
int h1,h0,s1,s0,m1,m0;
h=dat%(3600*24)/3600;
s=(dat%3600)/60;
m=dat%60;
h1=h/10;
h0=h%10;
s1=s/10;
s0=s%10;
m1=m/10;
m0=m%10;
seatport=seatt[5];
segport=segt[m0];
delayms(1);
seatport=seatt[4];
segport=segt[m1];
delayms(1);
seatport=seatt[3];
segport=segt[s0]+0x80;
delayms(1);
seatport=seatt[2];
segport=segt[s1];
delayms(1);
seatport=seatt[1];
segport=segt[h0]+0x80;
delayms(1);
seatport=seatt[0];
segport=segt[h1];
delayms(1);
}
void timerone() interrupt 3
{
TH1=0X3C;
TL1=0xB0;
round++;
if(round==20)
{
b--;
round=0;
}
}
void main(void)
{
b=999;
round=0;
TMOD=0x10;
EA=1;
ET1=1;
TH1=0x3C;
TL1=0xB0;
TR1=1;
while(1)
{
converthsmandshow(b);
}
}
復制代碼
全部資料下載地址:
倒計時.zip
(637 Bytes, 下載次數: 42)
2017-6-7 16:06 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
zdmjjp
時間:
2017-8-10 14:21
謝謝樓主分享,下載學習一下
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1