|
|
簡單計(jì)時(shí)器,通俗易懂,比較適合初學(xué)者,語句簡單。
#include<reg51.h>
unsigned char i=0;
unsigned char count=0,count1=0;
sbit P3_2=P3^2;
unsigned char code disptab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d
,0x7d,0x07,0x7f,0x6f};
void timer0(void) interrupt 1
{
i++;
if(i==20)
{
i=0;
count++;
}
if(count==60) {count=0;count1++;};
P1=disptab[count1];
P0=disptab[count/10];
P2=disptab[count%10];
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
}
|
-
-
-
附件.docx
2019-11-22 23:18 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
15.22 KB, 下載次數(shù): 7, 下載積分: 黑幣 -5
|