📄 main.lst
字号:
C51 COMPILER V8.08 MAIN 06/28/2008 15:24:32 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: E:\Program Files\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "CONFIG.H"
2 sbit Bell_Out = P1 ^ 5;//闹钟管脚输出
3 sbit Mcs = P3 ^ 5; //
4 sbit Scs = P3 ^ 4; //
5 sbit Add_Key = P1 ^ 0;//加1键
6 sbit Dec_Key = P1 ^ 1;//减1键
7 sbit OK_Key = P1 ^ 2;//确定键
8 sbit RST=P1^3;
9
10 bit flag, Bell_Swh,Hourb,Minb,Secb,Kgb;//闪烁标志位
11 bit sec=0,min=0,hour=0,year=0,mon=0,day=0,weekk=0; //闪烁标志位
12 unsigned char id,id2,d,e,S_8563,H_8563,H_2402,S_2402; //
13
14 void Disp(void);
15 void id_case1_key(void);
16 void id_case2_key(void);
17 void Set_time(unsigned char sel,bit sel_1);
18 void Timer0_Init(void);
19 void Set_Bell(unsigned char sel, bit sel_1);
20
21 void Disp(void)//显示和闪烁函数
22 {
23 1
24 1 unsigned int i=0;
25 1 unsigned char a=0,b=0,c=0,f=0;
26 1
27 1 i=ReadTemperature();//读温度并送显 如果加了这一温度程序,那么时间相差走得很慢,那位高手给小弟指导一下
28 1 a=i/100;
29 1 Mcs=1;
30 1 Scs=0;
31 1 Disp_Digit(6,40,zero+a*16);
32 1 b=i/10-a*10;
33 1 Mcs=1;Scs=0;
34 1 Disp_Digit(6,48,zero+b*16);
35 1 c=i-a*100-b*10;
36 1 Mcs=0;Scs=1;
37 1 Disp1_Digit(6,0,zero+c*16);
38 1
39 1
40 1 if((((read_clock(0x08))&0x80)>>7)==0)
41 1 {
42 2 d=2;e=0;
43 2 }
44 1 else
45 1 {
46 2 d=1;e=9;
47 2 }
48 1 Disp_Digit(0,0,zero+d*16);
49 1 Disp_Digit(0,8,zero+e*16);
50 1
51 1
52 1 Conversion(((read_clock(0x08))&0x80)>>7,read_clock(0x08),read_clock(0x07)&0x1F,read_clock(0x05)&0x3F);
-
53 1 Disp_Chinese(4,0,nong);
54 1 Disp_Chinese(4,16,li);
C51 COMPILER V8.08 MAIN 06/28/2008 15:24:32 PAGE 2
55 1 d=year_moon;//读年
56 1 e=d;
57 1 d=d>>4;
58 1 e=e&0x0f;
59 1 Disp_Digit(4,32,zero+d*16);
60 1 Disp_Digit(4,40,zero+e*16);
61 1 Disp_Chinese(4,48,nian);
62 1 d=month_moon;//读月
63 1 e=d;
64 1 d=d>>4;
65 1 e=e&0x0f;
66 1 Disp1_Digit(4,0,zero+d*16);
67 1 Disp1_Digit(4,8,zero+e*16);
68 1 Disp1_Chinese(4,16,yue);
69 1 d=day_moon;//读日
70 1 e=d;
71 1 d=d>>4;
72 1 e=e&0x0f;
73 1 Disp1_Digit(4,32,zero+d*16);
74 1 Disp1_Digit(4,40,zero+e*16);
75 1 Disp1_Chinese(4,48,ri);
76 1
77 1
78 1
79 1
80 1 if(sec==1) //秒闪烁标志位
81 1 {
82 2 if(flag==1)
83 2 {
84 3 d=read_clock(0x02);//读秒
85 3 d=d&0x7f;
86 3 d=((d&0x70)>>4)*10+(d&0x0f);
87 3 e=d;
88 3 d=d/10;
89 3 e=e%10;
90 3 Mcs=0;Scs=1;
91 3 Disp1_Digit(2,40,zero+d*16);//送显示
92 3 Disp1_Digit(2,48,zero+e*16);
93 3 }
94 2 else
95 2 {
96 3 Mcs=0;Scs=1;
97 3 Disp1_Digit(2,40,space); //显示空格
98 3 Disp1_Digit(2,48,space);
99 3 }
100 2 }
101 1 else
102 1 {
103 2 d=read_clock(0x02);//读秒
104 2 d=d&0x7f;
105 2 d=((d&0x70)>>4)*10+(d&0x0f);
106 2 e=d;
107 2 d=d/10;
108 2 e=e%10;
109 2 Mcs=0;Scs=1;
110 2 Disp1_Digit(2,40,zero+d*16);
111 2 Disp1_Digit(2,48,zero+e*16);
112 2 }
113 1
114 1 if(min==1) //分钟闪烁标志位
115 1 {
116 2 if(flag==1)
C51 COMPILER V8.08 MAIN 06/28/2008 15:24:32 PAGE 3
117 2 {
118 3 d=read_clock(0x03);//读分钟
119 3 d=d&0x7f;
120 3 e=d;
121 3 d=d>>4;
122 3 e=e&0x0f;
123 3 Mcs=0;Scs=1;
124 3 Disp1_Digit(2,16,zero+d*16);
125 3 Disp1_Digit(2,24,zero+e*16);
126 3 }
127 2 else
128 2 {
129 3 Mcs=0;Scs=1;
130 3 Disp1_Digit(2,16,space); //显示空格
131 3 Disp1_Digit(2,24,space);
132 3 }
133 2 }
134 1 else
135 1 {
136 2 d=read_clock(0x03);//读分钟
137 2 d=d&0x7f;
138 2 e=d;
139 2 d=d>>4;
140 2 e=e&0x0f;
141 2 Mcs=0;Scs=1;
142 2 Disp1_Digit(2,16,zero+d*16);
143 2 Disp1_Digit(2,24,zero+e*16);
144 2 }
145 1
146 1 if(hour==1) //小时闪烁标志位
147 1 {
148 2 if(flag==1)
149 2 {
150 3 d=read_clock(0x04);//读小时
151 3 d=d&0x3f;
152 3 if(d>0x12)
153 3 {
154 4 Disp1_Digit(0,48,p);
155 4 d=d-0x12;
156 4
157 4 }
158 3 else
159 3 {
160 4 Disp1_Digit(0,48,A);
161 4 }
162 3 e=d;
163 3 d=d>>4;
164 3 e=e&0x0f;
165 3 Mcs=1;Scs=0;
166 3 Disp_Digit(2,56,zero+d*16);
167 3 Mcs=0;Scs=1;
168 3 Disp1_Digit(2,0,zero+e*16);
169 3 }
170 2 else
171 2 {
172 3 Mcs=1;Scs=0;
173 3 Disp_Digit(2,56,space); //显示空格
174 3 Mcs=0;Scs=1;
175 3 Disp1_Digit(2,0,space);
176 3 }
177 2 }
178 1 else
C51 COMPILER V8.08 MAIN 06/28/2008 15:24:32 PAGE 4
179 1 {
180 2 d=read_clock(0x04);//读小时
181 2 d=d&0x3f;
182 2 if(d>0x12)
183 2 {
184 3 Disp1_Digit(0,48,p);
185 3 d=d-0x12;
186 3
187 3 }
188 2 else
189 2 {
190 3 Disp1_Digit(0,48,A);
191 3 }
192 2
193 2 e=d;
194 2 d=d>>4;
195 2 e=e&0x0f;
196 2 Mcs=1;Scs=0;
197 2 Disp_Digit(2,56,zero+d*16);
198 2 Mcs=0;Scs=1;
199 2 Disp1_Digit(2,0,zero+e*16);
200 2 }
201 1
202 1 if(year==1) //年闪烁标志位
203 1 {
204 2 if(flag==1)
205 2 {
206 3 d=read_clock(0x08);//读年
207 3 e=d;
208 3 d=d>>4;
209 3 e=e&0x0f;
210 3 Mcs=1;Scs=0;
211 3 Disp_Digit(0,16,zero+d*16);
212 3 Disp_Digit(0,24,zero+e*16);
213 3 }
214 2 else
215 2 {
216 3 Mcs=1;Scs=0;
217 3 Disp_Digit(0,16,space); //显示空格
218 3 Disp_Digit(0,24,space);
219 3 }
220 2 }
221 1 else
222 1 {
223 2 d=read_clock(0x08);//读年
224 2 e=d;
225 2 d=d>>4;
226 2 e=e&0x0f;
227 2 Mcs=1;Scs=0;
228 2 Disp_Digit(0,16,zero+d*16);
229 2 Disp_Digit(0,24,zero+e*16);
230 2 }
231 1
232 1 if(mon==1) //月闪烁标志位
233 1 {
234 2 if(flag==1)
235 2 {
236 3 d=read_clock(0x07);
237 3 d=d&0x1f;//读月
238 3 e=d;
239 3 d=d>>4;
240 3 e=e&0x0f;
C51 COMPILER V8.08 MAIN 06/28/2008 15:24:32 PAGE 5
241 3 Mcs=1;Scs=0;
242 3 Disp_Digit(0,48,zero+d*16);
243 3 Mcs=0;Scs=1;
244 3 Disp_Digit(0,56,zero+e*16);
245 3 Disp1_Chinese(0,0,yue);
246 3 }
247 2 else
248 2 {
249 3 Mcs=1;Scs=0;
250 3 Disp_Digit(0,48,space); //显示空格
251 3 Mcs=0;Scs=1;
252 3 Disp_Digit(0,56,space);
253 3 }
254 2 }
255 1 else
256 1 {
257 2 d=read_clock(0x07);//读月
258 2 d=d&0x1f;
259 2 e=d;
260 2 d=d>>4;
261 2 e=e&0x0f;
262 2 Mcs=1;Scs=0;
263 2 Disp_Digit(0,48,zero+d*16);
264 2 Mcs=0;Scs=1;
265 2 Disp_Digit(0,56,zero+e*16);
266 2 Disp1_Chinese(0,0,yue);
267 2 }
268 1
269 1 if(day==1) //日闪烁标志位
270 1 {
271 2 if(flag==1)
272 2 {
273 3 d=read_clock(0x05);//读日
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -