#include <STC89C5xRC.H>
void Delay300ms() //@11.0592MHz
{
unsigned char i, j, k;
i = 13;
j = 156;
k = 83;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
const unsigned char seg_code[] = {
0x3F,/*0*/
0x06,/*1*/
0x5B,/*2*/
0x4F,/*3*/
0x66,/*4*/
0x6D,/*5*/
0x7D,/*6*/
0x07,/*7*/
0x7F,/*8*/
0x6F,/*9*/
};
unsigned int xuehao = 65080;
void main(){
int i, j = 1, t;
t = 65850;
while(1){
for(i = 0;i < 5;i++){
P2 = i << 2;
P0 = seg_code[t%10];
t/=10;
if(t<0)t = 65850;
Delay300ms();
}
}
}
|