📄 yejin.lst
字号:
209 4 if(s1num==2) //第二个键被按二次,分钟加一
210 4 {
211 5 minute++;
212 5 if(minute==60)
213 5 minute=0;
214 5 write_sfm(7,minute);
215 5 write_com(0x80+0x40+7);
216 5 }
217 4 if(s1num==3) //第二个键被按三次,时钟加一
218 4 {
219 5 hour++;
220 5 if(hour==24)
221 5 hour=0;
222 5 write_sfm(4,hour);
223 5 write_com(0x80+0x40+4);
224 5 }
225 4 if(s1num==4)
226 4 {
227 5 day++;
228 5 if(day==30)
229 5 day=0;
230 5 write_lyr(11,day);
231 5 write_com(0x80+11);
232 5 }
233 4 if(s1num==5)
234 4 {
235 5 month++;
236 5 if(month==12)
237 5 month=0;
238 5 write_lyr(8,month);
239 5 write_com(0x80+8);
240 5 }
241 4 if(s1num==6)
C51 COMPILER V7.50 YEJIN 08/26/2008 11:19:59 PAGE 5
242 4 {
243 5 year++;
244 5 if(year==99)
245 5 year=0;
246 5 write_lyr(5,year);
247 5 write_com(0x80+5);
248 5 }
249 4 /*if(s1num==7)
250 4 {
251 4 week_proc();
252 4 write_com(0x80+12);
253 4 }*/
254 4 }
255 3 }
256 2 if(s3==0) //第三个键被按下
257 2 {
258 3 delay(5);
259 3 if(s3==0)
260 3 {
261 4 while(!s3);
262 4 if(s1num==1)
263 4 {
264 5 second--;
265 5 if(second==-1)
266 5 second=59;
267 5 write_sfm(10,second);
268 5 write_com(0x80+0x40+10);
269 5 }
270 4 if(s1num==2)
271 4 {
272 5 minute--;
273 5 if(minute==-1)
274 5 minute=59;
275 5 write_sfm(7,minute);
276 5 write_com(0x80+0x40+7);
277 5 }
278 4 if(s1num==3)
279 4 {
280 5 hour--;
281 5 if(hour==-1)
282 5 hour=23;
283 5 write_sfm(4,hour);
284 5 write_com(0x80+0x40+4);
285 5 }
286 4 if(s1num==4)
287 4 {
288 5 day--;
289 5 if(day==-1)
290 5 day=31;
291 5 write_lyr(11,day);
292 5 write_com(0x80+11);
293 5 }
294 4 if(s1num==5)
295 4 {
296 5 month--;
297 5 if(month==-1)
298 5 month=12;
299 5 write_lyr(8,month);
300 5 write_com(0x80+8);
301 5 }
302 4 if(s1num==6)
303 4 {
C51 COMPILER V7.50 YEJIN 08/26/2008 11:19:59 PAGE 6
304 5 year--;
305 5 if(year==-1)
306 5 year=99;
307 5 write_lyr(5,year);
308 5 write_com(0x80+5);
309 5 }
310 4 /*if(s1num==7)
311 4 {
312 4 week_proc();
313 4 write_com(0x80+12);
314 4 }*/
315 4 }
316 3
317 3 }
318 2 }
319 1 }
320
321
322 //---------主程序----------------------
323 void main()
324 {
325 1 init();
326 1 while(1)
327 1 {
328 2 keyscan();
329 2 }
330 1 }
331
332 //---------定时器中断---------------------
333 void timer0() interrupt 1
334 {
335 1 TH0=(65536-50000)/256;
336 1 TL0=(65536-50000)%256;
337 1 count++;
338 1 if(count==18)
339 1 {
340 2 count=0;
341 2 second++;
342 2 if(second==60)
343 2 {
344 3 second=0;
345 3 minute++;
346 3 if(minute==60)
347 3 {
348 4 minute=0;
349 4 hour++;
350 4 if(hour==24)
351 4 {
352 5 hour=0;
353 5 day++;
354 5 {
355 6 if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) //大月三十一天
356 6 if(day==32)
357 6 {
358 7 day=1;
359 7 month++;
360 7 }
361 6 if(month==4||month==6||month==9||month==11) //小月三十天
362 6 if(day==31)
363 6 {
364 7 day=1;
365 7 month++;
C51 COMPILER V7.50 YEJIN 08/26/2008 11:19:59 PAGE 7
366 7 }
367 6 if(month==2)
368 6 {
369 7 if(leap_year())
370 7 {
371 8 if(day==30) //闰年二月29天
372 8 {
373 9 day=1;
374 9 month++;
375 9 }
376 8 }
377 7 else
378 7 {
379 8 if(day==29) //非闰年二月28天
380 8 {
381 9 day=1;
382 9 month++;
383 9 }
384 8 }
385 7 }
386 6 //week_proc();
387 6 if(month==13)
388 6 {
389 7 month=1;
390 7 year++;
391 7 if(year==99)
392 7 {
393 8 year==0;
*** WARNING C275 IN LINE 393 OF YEJIN.C: expression with possibly no effect
394 8 }
395 7 write_lyr(5,year);
396 7 }
397 6 write_lyr(8,month);
398 6 }
399 5 write_lyr(11,day);
400 5 }
401 4 write_sfm(4,hour);
402 4 }
403 3 write_sfm(7,minute);
404 3 }
405 2 write_sfm(10,second);
406 2 }
407 1 }
408
409
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 997 ----
CONSTANT SIZE = 27 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 8 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -