1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
#include<intrins.h> #define uint unsigned int #define uchar unsigned char sbit duan=P2^6; sbit wei=P2^7; uchar temp,t0; uint count; uint t0_1,t0_count, m,n,num[6]; uchar code tableduan[]={ 0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71}; uchar code tablewei[]={ 0xfe,0xfd,0xfb,0xf7,0xef,0xdf}; void (); void display(unsigned long int input); void main() { init(); while(1) { for(count=60;count>0;count--) { display(count); t0_1=0; t0_count=0; } TR0=0; P1=0x00; duan=1; P0=0x00; duan=0;
}
}
void () { temp=0xfe; P1=temp; TMOD=0x11; TH0=(655360-5000)/256; TL0=(655360-5000)%256; EA=1; ET0=1; TR0=1; t0=0; t0_1=0; t0_count=0; } void display(unsigned long int input) { uchar m,n;
m=0; n=0;
if(input==0) { num[0]=0; n=1; } else for(n=0;input!=0;n++) { num[n]=input%10; input=input/10; } n--;
while(t0_count!=200) { if(t0_1==1) { t0_1=0; wei=1; P0=tablewei[m]; wei=0; duan=1; P0=tableduan[num[n-m]]; duan=0; m++; if(m==n+1) m=0; }
} } void timer0() interrupt 1 { TH0=(655360-5000)/256; TL0=(655360-5000)%256; t0++; t0_1++; t0_count++; if(t0==100) { t0=0; temp=_crol_(temp,1); P1=temp; } }
|
近期评论