📄 tclock.lst
字号:
C51 COMPILER V7.50 TCLOCK 08/17/2007 16:34:00 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE TCLOCK
OBJECT MODULE PLACED IN Tclock.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Tclock.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "reg51.h"
2
3 unsigned char code tab[]={0x3f,0x06,0x5b,0x4f,0x66,
4 0x6d,0x7d,0x07,0x7f,0x6f};
5 unsigned char dispbitcode[]={0x01,0x02,0x04,0x08,
6 0x10,0x20,};
7 unsigned char dispbuf[6]={0,0,0,0,0,0};
8
9 unsigned char dispbitcnt;
10 unsigned char second;
11 unsigned char minite;
12 unsigned char hour;
13 unsigned int tcnt;
14 unsigned char mstcnt;
15 unsigned char i,j;
16 sbit P0_0=P0^0;
17 sbit P0_1=P0^1;
18 sbit P0_2=P0^2;
19
20 void delay10ms(void)
21 {
22 1 unsigned char i,j,k;
23 1 for(i=5;i>0;i--)
24 1 for(j=4;j>0;j--)
25 1 for(k=248;k>0;k--);
26 1 }
27
28 void main(void)
29 {
30 1 TMOD=0x02;
31 1 TH0=0x06;
32 1 TL0=0x06;
33 1
34 1 TR0=1;
35 1 ET0=1;
36 1 EA=1;
37 1 while(1)
38 1 {
39 2 if(P0_0==0)
40 2 {
41 3 delay10ms();
42 3 if(P0_0==0)
43 3 {
44 4 second++;
45 4 if(second==60)
46 4 {
47 5 second=0;
48 5 }
49 4 dispbuf[0]=second%10;
50 4 dispbuf[1]=second/10;
51 4 while(P0_0==0);
52 4
53 4 }
54 3
55 3 }
C51 COMPILER V7.50 TCLOCK 08/17/2007 16:34:00 PAGE 2
56 2
57 2 if(P0_1==0)
58 2 {
59 3 delay10ms();
60 3 if(P0_1==0)
61 3 {
62 4 minite++;
63 4 if(minite==60)
64 4 {
65 5 minite=0;
66 5 }
67 4 dispbuf[2]=minite%10;
68 4 dispbuf[3]=minite/10;
69 4 while(P0_1==0);
70 4 }
71 3 }
72 2
73 2 if(P0_2==0)
74 2 {
75 3 delay10ms();
76 3 if(P0_2==0)
77 3 {
78 4 hour++;
79 4 if(hour==24)
80 4 {
81 5 hour=0;
82 5 }
83 4 dispbuf[4]=hour%10;
84 4 dispbuf[5]=hour/10;
85 4 while(P0_2==0);
86 4 }
87 3 }
88 2 }
89 1 }
90
91 void t0(void) interrupt 1 using 0
92 {
93 1 mstcnt++;
94 1 if(mstcnt==8)
95 1 {
96 2 mstcnt=0;
97 2 P1=tab[dispbuf[dispbitcnt]];
98 2 P2=dispbitcode[dispbitcnt];
99 2 dispbitcnt++;
100 2 if(dispbitcnt==6)
101 2 {
102 3 dispbitcnt=0;
103 3 }
104 2 }
105 1
106 1 tcnt++;
107 1 if(tcnt==4000)
108 1 {
109 2 tcnt=0;
110 2 second++;
111 2 if(second==60)
112 2 {
113 3 second=0;
114 3 minite++;
115 3 if(minite==60)
116 3 {
117 4 minite=0;
C51 COMPILER V7.50 TCLOCK 08/17/2007 16:34:00 PAGE 3
118 4 hour++;
119 4 if(hour==24)
120 4 {
121 5 hour=0;
122 5 }
123 4 }
124 3 }
125 2 dispbuf[0]=second%10;
126 2 dispbuf[1]=second/10;
127 2 dispbuf[2]=minite%10;
128 2 dispbuf[3]=minite/10;
129 2 dispbuf[4]=hour%10;
130 2 dispbuf[5]=hour/10;
131 2 }
132 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 314 ----
CONSTANT SIZE = 10 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 21 ----
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 + -