📄 main.lst
字号:
C51 COMPILER V8.02 MAIN 04/13/2012 20:04:08 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /******************************************************************/
2 //#作者
3 // BLF。
4 //#功能
5 // 1.电子日历,显示年月日、时分秒、星期和温度
6 // 2.利用4个按键调整,set键按下一次调解年月日星期时分秒,并闪烁,加减键调节闪烁的量
7 //#编写时间
8 // 2011年5月31日。
9 /******************************************************************/
10 #include<reg51.h>
11 #include"ds1302.c"
12 #include"1602.c"
13 #include"ds18b20.c"
14 #include"key.c"
15 #define uchar unsigned char
16 #define uint unsigned int
17 uchar cp,flash,Temp;
18 /*******************************显示函数***************************/
19 void display(void)
20 {
21 1 //F1602_clear();
22 1 gotoxy(1,0); //第一行
23 1 display_string("20");//显示20
24 1 if(key_set_flag == 1)//显示年的调整值并闪烁
25 1 {
26 2 if(flash)display_num(time_tmp[0]);
27 2 else display_string(" ");
28 2 }
29 1 else display_num(year);
30 1 display_string("/");
31 1 if(key_set_flag == 2)//显示月的调整值并闪烁
32 1 {
33 2 if(flash)display_num(time_tmp[1]);
34 2 else display_string(" ");
35 2 }
36 1 else display_num(moon);
37 1 display_string("/");
38 1 if(key_set_flag == 3)//显示日的调整值并闪烁
39 1 {
40 2 if(flash)display_num(time_tmp[2]);
41 2 else display_string(" ");
42 2 }
43 1 else display_num(date);
44 1 display_string(" WEEK");
45 1 if(key_set_flag == 4)//显示星期的调整值并闪烁
46 1 {
47 2 if(flash)write_data(num[time_tmp[3]]);
48 2 else display_string(" ");
49 2 }
50 1 else write_data(num[week]);
51 1 gotoxy(2,0); //第二行
52 1 if(key_set_flag == 5)//显示小时的调整值并闪烁
53 1 {
54 2 if(flash)display_num(time_tmp[4]);
55 2 else display_string(" ");
C51 COMPILER V8.02 MAIN 04/13/2012 20:04:08 PAGE 2
56 2 }
57 1 else display_num(hour);
58 1 if(flash == 0x00)display_string(":");else if(flash == 0xff)display_string(" ");//冒号闪烁
59 1 if(key_set_flag == 6)//显示分的调整值并闪烁
60 1 {
61 2 if(flash)display_num(time_tmp[5]);
62 2 else display_string(" ");
63 2 }
64 1 else display_num(min);
65 1 if(flash == 0x00)display_string(":");else if(flash == 0xff)display_string(" ");//冒号闪烁
66 1 if(key_set_flag == 7)//显示秒的调整值并闪烁
67 1 {
68 2 if(flash)display_num(time_tmp[6]);
69 2 else display_string(" ");
70 2 }
71 1 else display_num(sec);
72 1 display_string(" T ");display_num(Temp);display_string("C");
73 1 }
74 /*****************************中断服务函数**************************/
75 void timer0_isr(void) interrupt 1
76 {
77 1 TMOD = 0x01;
78 1 TH0 = (65536 - 4000)/256;
79 1 TL0 = (65536 - 4000)%256;
80 1 cp++;
81 1 if(cp >= 100) //半秒
82 1 {
83 2 cp = 0;
84 2 flash = ~flash;
85 2 display();
86 2 }
87 1 }
88 /*****************************中断初始化函数***********************/
89 void timer0_init(void)
90 {
91 1 TMOD = 0x01;
92 1 TH0 = (65536 - 4000)/256;
93 1 TL0 = (65536 - 4000)%256;
94 1 ET0 = 1;
95 1 EA = 1;
96 1 TR0 = 1;
97 1 }
98 /********************************主函数函数***********************/
99 void main(void)
100 {
101 1 timer0_init();
102 1 F1602_init();
103 1 F1602_clear();
104 1 while(1)
105 1 {
106 2 key();
107 2 get_ds1302_time();
108 2 Temp = Read_Temperature();
109 2 }
110 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1140 ----
CONSTANT SIZE = 26 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
C51 COMPILER V8.02 MAIN 04/13/2012 20:04:08 PAGE 3
DATA SIZE = 39 1
IDATA SIZE = ---- ----
BIT SIZE = 4 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -