📄 main_1.lst
字号:
C51 COMPILER V7.09 MAIN_1 11/03/2005 12:31:51 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE MAIN_1
OBJECT MODULE PLACED IN main_1.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main_1.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "zhaobin.h"
2 unsigned char xdata address_377 _at_ 0x07ff;
3
4 void delay ( unsigned char dk)
5 {
6 1 unsigned char tt;
7 1 for (tt=0;tt<dk;tt++)
8 1 { _nop_ (); _nop_ ();
9 2 }
10 1 }
11
12 void delay_long ( unsigned char sb,unsigned int nba)
13 {
14 1 unsigned char qq;
15 1 unsigned int tm;
16 1 for (qq=0;qq<sb;qq++)
17 1 {
18 2 for (tm=0;tm<nba;tm++)
19 2 { _nop_ (); _nop_ (); _nop_ (); _nop_ (); _nop_ (); _nop_ (); _nop_ (); _nop_ (); }
20 2 }
21 1 }
22
23
24
25
26 unsigned char read_key (void)
27 {
28 1 unsigned char temp,temp1;
29 1 temp=1; temp1=0;
30 1 if (key1!=1)
31 1 {
32 2 delay (50);
33 2 for (temp1=1;temp1<9;temp1++)
34 2 {
35 3 address_377=temp; _nop_ ();
36 3 _nop_ (); _nop_ (); _nop_ (); _nop_ ();
37 3 if (key1==1)
38 3 { address_377=0; _nop_ (); _nop_ (); _nop_ ();
39 4 while (~key1); delay (100); return (temp1);
40 4 }
41 3 temp=temp<<1;
42 3 }
43 2 }
44 1
45 1 if (key2!=1)
46 1 {
47 2 delay (50);
48 2 for (temp1=1+8;temp1<9+8;temp1++)
49 2 {
50 3 address_377=temp; _nop_ ();
51 3 _nop_ (); _nop_ (); _nop_ (); _nop_ ();
52 3 if (key2==1)
53 3 { address_377=0; _nop_ (); _nop_ (); _nop_ ();
54 4 while (~key2); delay (100); return (temp1);
55 4 }
C51 COMPILER V7.09 MAIN_1 11/03/2005 12:31:51 PAGE 2
56 3 temp=temp<<1;
57 3 }
58 2 }
59 1 return (temp1);
60 1 }
61
62 unsigned char sec_10 (void)
63 { unsigned char temp;
64 1 temp=(read_sec ()&0x70)*10;
65 1 temp=(read_sec ()&0x0f)+temp;
66 1 return (temp);
67 1 }
68
69 unsigned char min_10 (void)
70 { unsigned char temp;
71 1 temp=(read_min ()&0x70)*10;
72 1 temp=(read_min ()&0x0f)+temp;
73 1 return (temp);
74 1 }
75
76 unsigned char hour_10 (void)
77 { unsigned char temp;
78 1 temp=(read_hour ()&0x30)*10;
79 1 temp=(read_hour ()&0x0f)+temp;
80 1 return (temp);
81 1 }
82
83
84
85
86
87 void main (void)
88 {
89 1 unsigned char temp_sec,temp_min,temp_hour;
90 1 unsigned char temp1,temp2,temp4,temp5,temp7,temp8;
91 1 unsigned char clock_1,clock_2,clock_4,clock_5,clock_7,clock_8;
92 1 unsigned char dbd,clock_hour,clock_min;
93 1 unsigned char key14,m2,temp,temp11;
94 1 bit flage_clock;
95 1 flage_clock=0;
96 1 clock_hour=clock_min=clock_1=clock_2=clock_4=clock_5=clock_7=clock_8=dbd=key14=m2=0;
97 1 _nop_ ();
98 1 _nop_ ();
99 1 speak0=0; speak1=0; speak2=0;
100 1 init_max7219 ();
101 1 init_ht1380 ();
102 1 _nop_ ();
103 1 address_377=0;
104 1 write_max7219 (0x030a);
105 1 write_max7219 (0x060a);
106 1 display_sec ();
107 1 display_min ();
108 1 display_hour ();
109 1 _nop_ ();
110 1
111 1 temp_sec=sec_10 ();
112 1 temp_min=min_10 ();
113 1 temp_hour=hour_10 ();
114 1
115 1
116 1
117 1
C51 COMPILER V7.09 MAIN_1 11/03/2005 12:31:51 PAGE 3
118 1 while (1)
119 1 {
120 2 main_loop:
121 2 speak0=0; speak1=0; speak2=0;
122 2 key14=0;
123 2 _nop_ ();
124 2 /*
125 2 if (temp_sec!=read_sec ()) display_sec ();
126 2 if (temp_min!=read_min ()) display_min ();
127 2 if (temp_hour!=read_hour ()) display_hour ();
128 2 temp_sec=read_sec ();
129 2 temp_min=read_min ();
130 2 temp_hour=read_hour ();
131 2 */
132 2 display_sec ();
133 2 display_min ();
134 2 display_hour ();
135 2 address_377=0;
136 2 _nop_ (); _nop_ (); _nop_ ();
137 2 dbd=0;
138 2 dbd=read_key ();
139 2 if (dbd!=0)
140 2 {
141 3 address_377=0; _nop_ (); _nop_ (); _nop_ ();
142 3 temp_sec=sec_10 ()+3;
143 3 if ((dbd>=11)&&(dbd<=16))
144 3 {
145 4 if (dbd==14) /////////看日期和星期
146 4 {
147 5 while (1)
148 5 {
149 6 display_year (); display_month (); display_date (); temp=sec_10 ();
150 6 delay (100);
151 6
152 6 if (read_key ()==14) //////////看星期
153 6 { display_day (); temp_sec=sec_10 ()+3; temp=sec_10 ();
154 7 while (1)
155 7 { temp=sec_10 (); delay (100);
156 8 if (temp>temp_sec) goto main_loop;
157 8 if (read_key ()==14) ///////////看闹钟
158 8 { temp11=clock_hour&0x0f;
159 9 write_max7219 (256*2|temp11);
160 9 temp11=clock_hour&0x70;
161 9 temp11=temp11>>4;
162 9 temp11=0x0f&temp11;
163 9 write_max7219 (256*1|temp11);
164 9
165 9 temp11=clock_min&0x0f;
166 9 write_max7219 (256*5|temp11);
167 9 temp11=clock_min&0x70;
168 9 temp11=temp11>>4;
169 9 temp11=0x0f&temp11;
170 9 write_max7219 (256*4|temp11);
171 9 if (flage_clock) { write_max7219 (0x0700); write_max7219 (0x080e); }
172 9 else { write_max7219 (0x070b); write_max7219 (0x080b); }
173 9 temp_sec=sec_10 ()+3;
174 9 while (1)
175 9 { temp=sec_10 (); delay (100);
176 10 if (temp>temp_sec) goto main_loop;
177 10 if (read_key ()==14) goto main_loop;
178 10 }
179 9 }
C51 COMPILER V7.09 MAIN_1 11/03/2005 12:31:51 PAGE 4
180 8 } }
181 6
182 6 if (temp>temp_sec) goto main_loop;
183 6 }
184 5 }
185 4
186 4
187 4
188 4 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-////
189 4
190 4
191 4
192 4
193 4
194 4 if (dbd==13) /////////闹铃是否打开
195 4 { flage_clock=~flage_clock;
196 5 if (flage_clock)
197 5 { write_max7219 (0x0100); write_max7219 (0x020e); write_max7219 (0x030a); write_max7219 (0
-x040a);
198 6 write_max7219 (0x050a); write_max7219 (0x060a); write_max7219 (0x070a); write_max7219 (0x080a);
199 6 }
200 5 else
201 5 { write_max7219 (0x010b); write_max7219 (0x020b); write_max7219 (0x030e); write_max7219 (0x040a)
-;
202 6 write_max7219 (0x050a); write_max7219 (0x060a); write_max7219 (0x070a); write_max7219 (0x080a);
203 6 }
204 5 temp=sec_10 (); temp=temp+2; delay (100);
205 5 while (1)
206 5 { temp_sec=sec_10 (); delay (100);
207 6 if (temp_sec>temp)
208 6 { write_max7219 (0x030a); goto main_loop; }
209 6 _nop_ (); _nop_ ();
210 6 if (read_key ()==14)
211 6 { write_max7219 (0x030a); goto main_loop; }
212 6 _nop_ (); _nop_ ();
213 6
214 6 }
215 5 }
216 4 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-///////
217 4
218 4
219 4
220 4
221 4
222 4
223 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -