标签:bit ide == void open view err alt div
1 #include <reg52.h> 2 #define uchar unsigned char 3 #define uint unsigned int 4 sbit LA =P2^2; 5 sbit LB =P2^3; 6 sbit LC =P2^4; 7 uchar t1,shu; 8 uchar code table[]={ 9 0x3f,0x06,0x5b,0x4f, 10 0x66,0x6d,0x7d,0x07, 11 0x7f,0x6f,0x77,0x7c, 12 0x39,0x5e,0x79,0x71, 13 0x76,0x79,0x38,0x3f,0}; 14 void main() 15 { 16 shu =8; 17 TMOD=0x01; 18 TH0=(65536-50000)/256; 19 TL0=(65536-50000)%256; 20 EA =1; 21 ET0 =1; 22 TR0 =1; 23 while(1); 24 25 } 26 void timer0() interrupt 1 27 { 28 TH0=(65536-50000)/256; 29 TL0=(65536-50000)%256; 30 t1++; 31 if(t1==2) 32 { 33 t1 =0; //如果t1 不清零的话,就会不停地加数,一直加到溢出后,从0开始重来这样时间就出现问题了 34 shu--; 35 LA =1; 36 LB =1; 37 LC =0; 38 P0 =table[shu]; 39 if(shu==2) 40 { 41 TR0 =0; 42 } 43 } 44 }
标签:bit ide == void open view err alt div
原文地址:https://www.cnblogs.com/wises/p/9539576.html