欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
0-999秒表程序
[打印本頁]
作者:
shi1918844682
時間:
2018-5-2 22:12
標題:
0-999秒表程序
#include <STC12C5A60S2.H>
#define ENLED P11
#define Interrupt
unsigned char code LedChar[10] =
{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char LedBuff[6] =
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
void T0init()
{
TMOD &= 0xF0;
TMOD |= 0x01;
TH0 = 0xF5;
TR0 = 1;
EA = 1;
ET0 = 1;
TF0 = 0;
}void LED_Scan(unsigned long sec)
{
static unsigned char i = 0;
unsigned char j = 6;
while(j)
{
LedBuff[j-1] = LedChar[sec%10];
sec /= 10;j--;
}
P2 = ~0x07;
P2 |= i%6;
P0 = LedBuff[(i++)%6];
}void main()
{
T0init();
ENLED = 0;
while(1)
{
#ifndef Interrupt
void TF0_Scan();
TF0_Scan();
#endif
}
}
#ifdef Interrupt
void interrupt_Scan() interrupt 1
{
static unsigned int cnt = 0;
static unsigned long sec = 0;
TF0 = 0;
TH0 = 0xF5;
TL0 = 0x95;
cnt++;
if(cnt >=999)
{
cnt = 0;
sec++;
if(sec >9)
{
P13=0;sec=0;
}
}
LED_Scan(sec);
}
#else void TF0_Scan()
{
static unsigned int cnt = 0;
static unsigned long sec = 0;
if(TF0 == 1)
{
TF0 = 0;
TH0 = 0xF5;
TL0 = 0x95;
cnt++;
if(cnt >= 999)
{
cnt = 0;
sec++;
if(sec > 9)
{
P13=0;
sec=0;
}
}
LED_Scan(sec);
}
}
#endif
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1