📄 pinlvji4.lst
字号:
184 1 SetCur(1); //开光标显示、闪烁
185 1 WriteString(h,0,0);
186 1 WriteString(s1,0,1);
187 1 WriteString(s2,0,1);
188 1
189 1
190 1 TMOD=0x15; //T0工作为16位计数器(方式1),T1工作方式为16位定时器
191 1 TH0=0; //计数为65536
192 1 TL0=0; //
193 1 TH1=(65536-50000)/256; //定时器采用定时50ms. 初值为50000
194 1 TL1=(65536-50000)%256;
195 1 TR1=1; //TR1=1,控制开关闭合,计数脉冲进入T1计数器,启动定时
196 1 TR0=1; //TR0=1,控制开关闭合,计数脉冲进入T0计数器,启动计数
197 1 ET0=1; //定时器0开中断
198 1 ET1=1; //定时器1开中断
199 1 EA=1; //CPU开中断
200 1
201 1 while(1)
202 1 {
203 2 if(KEY==0)
204 2 {
205 3 mDelay(10);
206 3 if(KEY==0)
207 3 {
208 4 mark++;
209 4 if(mark==4)
210 4 mark=1;
211 4 while(~KEY);
212 4 }
213 3 }
214 2
215 2 if(flag==1)
216 2 {
217 3 flag=0; //清标志位
218 3 if(mark==1)
219 3 {
220 4 x=(T0count*65536+256*TH0+TL0)*10;
221 4 LcdPos(15,1);
222 4 WriteString(s1,0,1);
223 4 WriteChar(table1[(x%100000)%10000%1000%100%10],11,1);
224 4 WriteChar(table1[(x%100000)%10000%1000%100/10],10,1);
225 4 WriteChar(table1[(x%100000)%10000%1000/100],9,1);
226 4 WriteChar(table1[x%100000%10000/1000],8,1);
227 4 WriteChar(table1[(x%100000)/10000],7,1);
228 4 WriteChar(table1[(x/100000)],6,1);
229 4 WriteString(h,0,0);
230 4 WriteChar(0x30,0,0);
231 4 WriteChar(0x2e,1,0);
232 4 WriteChar(0x31,2,0);
233 4 WriteChar(0x53,3,0);
234 4 if(x>99999)
235 4 {
236 5 WriteString(s2,0,1);
237 5 }
238 4 }
239 3
240 3 if(mark==2)
241 3 {
C51 COMPILER V7.50 PINLVJI4 10/26/2008 13:11:34 PAGE 5
242 4 x=T0count*65536+256*TH0+TL0;
243 4 LcdPos(15,1);
244 4 WriteString(s1,0,1);
245 4 WriteChar(table1[(x%100000)%10000%1000%100%10],11,1);
246 4 WriteChar(table1[(x%100000)%10000%1000%100/10],10,1);
247 4 WriteChar(table1[(x%100000)%10000%1000/100],9,1);
248 4 WriteChar(table1[x%100000%10000/1000],8,1);
249 4 WriteChar(table1[(x%100000)/10000],7,1);
250 4 WriteChar(table1[(x/100000)],6,1);
251 4 WriteString(h,0,0);
252 4 WriteChar(0x31,0,0);
253 4 WriteChar(0x53,1,0);
254 4 if(x>99999)
255 4 {
256 5 WriteString(s2,0,1);
257 5 }
258 4 }
259 3
260 3 if(mark==3)
261 3 {
262 4 x=(T0count*65536+256*TH0+TL0)/10;
263 4 LcdPos(15,1);
264 4 WriteString(s1,0,1);
265 4 WriteChar(table1[(x%100000)%10000%1000%100%10],11,1);
266 4 WriteChar(table1[(x%100000)%10000%1000%100/10],10,1);
267 4 WriteChar(table1[(x%100000)%10000%1000/100],9,1);
268 4 WriteChar(table1[x%100000%10000/1000],8,1);
269 4 WriteChar(table1[(x%100000)/10000],7,1);
270 4 WriteChar(table1[(x/100000)],6,1);
271 4 WriteString(h,0,0);
272 4 WriteChar(0x31,0,0);
273 4 WriteChar(0x30,1,0);
274 4 WriteChar(0x53,2,0);
275 4 if(x>99999)
276 4 {
277 5 WriteString(s2,0,1);
278 5 }
279 4 }
280 3
281 3
282 3
283 3
284 3
285 3 //LCD显示部分代码
286 3 // ;==================================================================================
287 3 timecount=0;
288 3 T0count=0;
289 3 TH0=0;
290 3 TL0=0;
291 3 TR0=1; //TR0=1,控制开关闭合,计数脉冲进入T1计数器,启动计数
292 3 }
293 2 }
294 1 }
295 //;==================================================================================
296
297 void t0() interrupt 1 using 0 //T0中断服务
298 {
299 1 T0count++; //对P3。4口的脉冲进行计数
300 1 }
301 //;==================================================================================
302
303 void t1(void) interrupt 3 using 0 //T1中断服务
C51 COMPILER V7.50 PINLVJI4 10/26/2008 13:11:34 PAGE 6
304 {
305 1 TH1=(65536-50000)/256; //计数初值重装载
306 1 TL1=(65536-50000)%256;
307 1 timecount++;
308 1
309 1 if(mark==1)
310 1 {
311 2 if(timecount==2)
312 2 {
313 3 TR0=0;
314 3 timecount=0;
315 3 flag=1; // 置标志
316 3 }
317 2 }
318 1 if(mark==2)
319 1 {
320 2 if(timecount==20)
321 2 {
322 3 TR0=0;
323 3 timecount=0;
324 3 flag=1; // 置标志
325 3 }
326 2 }
327 1 if(mark==3)
328 1 {
329 2
330 2 if(timecount==200)
331 2 {
332 3 TR0=0;
333 3 timecount=0;
334 3 flag=1; // 置标志
335 3 }
336 2 }
337 1 }
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2149 ----
CONSTANT SIZE = 55 ----
XDATA SIZE = ---- ----
C51 COMPILER V7.50 PINLVJI4 10/26/2008 13:11:34 PAGE 7
PDATA SIZE = ---- ----
DATA SIZE = 20 9
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -