?? test.lst
字號(hào):
C51 COMPILER V7.07 TEST 09/12/2008 21:58:51 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE TEST
OBJECT MODULE PLACED IN test.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE test.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <AT89X51.H>
2 unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,
3 0x66,0x6d,0x7d,0x07,
4 0x7f,0x6f,0x00,0x40}; //0x77,0x7c, 0x39,0x5e,0x79,0x71,
5 unsigned char dispbitcode[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
6 unsigned char dispbuf[8]={0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa};
7 unsigned char dispbuff[8]={0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa};
8 unsigned char dispbufff[8] ={0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa};
9 bit flag=1;
10 bit sflag=1;
11 bit sflage=1;
12 unsigned char sec ;
13 unsigned char dispbitcnt;
14 unsigned char second;
15 unsigned char minite;
16 unsigned char hour;
17 unsigned int tcnt;
18 unsigned char mstcnt;
19 unsigned char i,j;
20 unsigned char shi;
21 unsigned char qian;
22 unsigned char shiwan;
23 unsigned char one_time=2;//完成一次跳變的時(shí)間 秒
24 unsigned int half_sec;
25 unsigned char count;
26 void delay();
27 void main(void)
28 {
29 1 TMOD=0x22;
30 1 TH0=0x06;
31 1 TL0=0x06;
32 1 TR0=1;
33 1 ET0=1;
34 1 TH1=0x06;
35 1 TL1=0x06;
36 1 TR1=1;
37 1 ET1=1;
38 1
39 1 EX0=1;
40 1 IT0=1;
41 1 EA=1;
42 1
43 1 while(1)
44 1 { P1_1=1;P1_2=1;P1_3=1;
45 2
46 2
47 2
48 2 if(P1_4==0)
49 2 {
50 3 delay();
51 3 if(P1_4==0)
52 3 sflag=0;
53 3 }
54 2
55 2 if(P1_5==0)
C51 COMPILER V7.07 TEST 09/12/2008 21:58:51 PAGE 2
56 2 {
57 3 delay();
58 3 if(P1_5==0)
59 3 {
60 4 one_time++;if(one_time==99) one_time=3;
61 4
62 4 }
63 3 while(P1_5==0);
64 3 }
65 2 if(P1_6==0)
66 2 {
67 3 delay();
68 3 if(P1_6==0)
69 3 {
70 4 one_time--;
71 4 if(one_time==0) one_time=3;
72 4 }
73 3
74 3 while(P1_6==0);
75 3 }
76 2 if(P1_7==0)
77 2 {
78 3 delay();
79 3 if(P1_7==0)
80 3 sflag=1;
81 3 }
82 2 }
83 1 }
84 void t0(void) interrupt 1 using 0
85 {
86 1 mstcnt++;
87 1 if(mstcnt==8)
88 1 {
89 2 mstcnt=0;
90 2 P2=~0xff;
91 2 if(sflag)
92 2 { if(flag)
93 3 P0=~dispcode[dispbuff[dispbitcnt]];
94 3 else
95 3 P0=~dispcode[dispbuf[dispbitcnt]];
96 3 }
97 2 else P0=~dispcode[dispbufff[dispbitcnt]];
98 2
99 2 P2=~dispbitcode[dispbitcnt];
100 2 dispbitcnt++;
101 2 if(dispbitcnt==8)
102 2 {
103 3 dispbitcnt=0;
104 3 }
105 2 }
106 1
107 1 dispbuf[7]=second%10;
108 1 dispbuf[6]=second/10;
109 1 dispbuf[5]=11;
110 1 dispbuf[4]=minite%10;
111 1 dispbuf[3]=minite/10;
112 1 dispbuf[2]=11;
113 1 dispbuf[1]=hour%10;
114 1 dispbuf[0]=hour/10;
115 1
116 1 dispbuff[2]=shiwan/10;
117 1 dispbuff[3]=shiwan%10;
C51 COMPILER V7.07 TEST 09/12/2008 21:58:51 PAGE 3
118 1 dispbuff[4]=qian/10;
119 1 dispbuff[5]=qian%10;
120 1 dispbuff[6]=shi/10;
121 1 dispbuff[7]=shi%10;
122 1
123 1 if((shiwan==0)&&(qian==0))
124 1 { dispbuff[2]=10;dispbuff[3]=10;dispbuff[4]=10;dispbuff[5]=10;}
125 1 else if(shiwan==0)
126 1 { dispbuff[2]=10;dispbuff[3]=10;}
127 1
128 1
129 1 dispbufff[6]=one_time/10;
130 1 dispbufff[7]=one_time%10;
131 1
132 1
133 1 }
134 void t1(void) interrupt 3 using 2
135 {
136 1
137 1 half_sec++;
138 1 if(half_sec==2000)
139 1 {
140 2 half_sec=0;count++;
141 2 if(count>=one_time){P1_0=~P1_0;count=0;}
142 2 }
143 1
144 1 tcnt++;
145 1 if(tcnt==4000)
146 1 {
147 2 tcnt=0;
148 2 sec++;
149 2 if(sec==3)
150 2 {sec=0;flag=~flag;}
151 2 second++;
152 2 if(second==60)
153 2 {
154 3 second=0;
155 3 minite++;
156 3 if(minite==60)
157 3 {
158 4 minite=0;
159 4 hour++;
160 4 }
161 3 }
162 2
163 2 }
164 1
165 1 }
166
167
168 void it0(void) interrupt 0
169 {
170 1 shi++;
171 1
172 1 if(shi==100)
173 1 {
174 2 shi=0;
175 2 qian++;
176 2 if(qian==100)
177 2 {
178 3 qian=0;
179 3 shiwan++;
C51 COMPILER V7.07 TEST 09/12/2008 21:58:51 PAGE 4
180 3 }
181 2 }
182 1
183 1 }
184
185 void delay()
186 {
187 1 for(j=248;j!=0;j--);
188 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 477 ----
CONSTANT SIZE = 12 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 49 ----
IDATA SIZE = ---- ----
BIT SIZE = 3 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -