📄 cs15-3.lst
字号:
C51 COMPILER V7.06 CS15_3 02/18/2007 10:55:41 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE CS15_3
OBJECT MODULE PLACED IN CS15-3.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE CS15-3.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include<REG51.H>
2 #define uint unsigned int
3 #define uchar unsigned char
4 uchar code SEG7[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
5 uchar code ACT[4]={0xfe,0xfd,0xfb,0xf7};
6 uint hour;
7 uchar min,sec,cnt;
8 uchar status;
9 void delay(uint k);
10 //***********************************
11 union deda
12 {
13 uint dhour;
14 uchar dmin;
15 uchar dsec;
16 };
17 union deda dis_buff;
18 //***********************************
19 void initial(void)
20 {
21 1 TMOD=0x01;
22 1 TH0=-(50000/256);
23 1 TL0=-(50000%256);
24 1 ET0=1;
25 1 TR0=1;
26 1 EA=1;
27 1 }
28 //***********************************
29 void time0(void) interrupt 1
30 {
31 1 TH0=-(50000/256);
32 1 TL0=-(50000%256);
33 1 cnt++;
34 1 if(cnt>=20){sec++;cnt=0;}
35 1 if(sec>=60){min++;sec=0;status++;}
36 1 if(min>=60){hour++;min=0;}
37 1 if(hour>9999){hour=0;}
38 1 if(status>2){status=0;}
39 1 switch(status)
40 1 {
41 2 case 0:dis_buff.dhour=hour;break;
42 2 case 1:dis_buff.dmin=min;break;
43 2 case 2:dis_buff.dsec=sec;break;
44 2 default:break;
45 2 }
46 1 }
47 //***********************************
48 void main(void)
49 {
50 1 initial();
51 1 for(;;)
52 1 {
53 2 switch(status)
54 2 {
55 3 case 0:{P0=SEG7[dis_buff.dhour%10];P2=ACT[0];delay(1);
C51 COMPILER V7.06 CS15_3 02/18/2007 10:55:41 PAGE 2
56 4 P0=SEG7[(dis_buff.dhour%100)/10];P2=ACT[1];delay(1);
57 4 P0=SEG7[(dis_buff.dhour%1000)/100];P2=ACT[2];delay(1);
58 4 P0=SEG7[dis_buff.dhour/1000];P2=ACT[3];delay(1);}break;
59 3 case 1:{P0=SEG7[dis_buff.dmin%10];P2=ACT[2];delay(1);
60 4 P0=SEG7[dis_buff.dmin/10];P2=ACT[3];delay(1);}break;
61 3 case 2:{P0=SEG7[dis_buff.dsec%10];P2=ACT[0];delay(1);
62 4 P0=SEG7[dis_buff.dsec/10];P2=ACT[1];delay(1);}break;
63 3 default:break;
64 3 }
65 2 }
66 1 }
67 //***********************************
68 void delay(uint k)
69 {
70 1 uint data i,j;
71 1 for(i=0;i<k;i++){
72 2 for(j=0;j<121;j++)
73 2 {;}}
74 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 414 ----
CONSTANT SIZE = 14 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 8 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -