📄 dds.lst
字号:
C51 COMPILER V7.50 DDS 06/17/2008 08:02:25 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE DDS
OBJECT MODULE PLACED IN dds.OBJ
COMPILER INVOKED BY: D:\Program Files\Keil\C51\BIN\C51.EXE dds.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include<reg52.h>
2 #include<lcd.h>
3 #include<1302.h>
4 #include<music_code.h>
5 #include<SoundPlay.h>
6 #include<dds.h>
7 uchar code time[]={'0','1','2','3','4','5','6','7','8','9'};
8 uchar code get_up[]="Time to Get up!";
9 uchar code str[]="Never frown,even when you are sad,because you never know who is falling in love with you
-r smile! To the world you may be one person,but to one person you may be the world ";
10 uchar code menu[4][10]={{"Time Set"},{"Music"},{"Books"},{"Ring Set"}};
11 void main()
12 {
13 1 ini();
14 1 open();
15 1 delay(255);
16 1 delay(255);
17 1 delay(255);
18 1 delay(255);
19 1 write_order(0x01);
20 1 init_ds1302();
21 1 set_ds1302(time_add,initial_time);
22 1 while(1)
23 1 {
24 2 read_ring();
25 2 if(ring_time[0]==now_time[0]&&ring_time[1]==now_time[1]&&ring_time[2]==now_time[2])
26 2 {
27 3 timeup();
28 3 }
29 2 detect();
30 2 write_order(0x80+0x04);
31 2 for(i=0;menu[key][i]!=0;i++)
32 2 {
33 3 write_date(menu[key][i]);
34 3 }
35 2 get_ds1302();
36 2 write_order(0x80+0x40);
37 2 write_date(time[now_time[4]>>4]);
38 2 write_date(time[now_time[4]&0x0f]);
39 2 write_date(0x01);
40 2 write_date(time[now_time[3]>>4]);
41 2 write_date(time[now_time[3]&0x0f]);
42 2 write_date(0x00);
43 2 write_date(' ');
44 2 write_date(' ');
45 2 write_date(time[now_time[2]>>4]);
46 2 write_date(time[now_time[2]&0x0f]);
47 2 write_date(':');
48 2 write_date(time[now_time[1]>>4]);
49 2 write_date(time[now_time[1]&0x0f]);
50 2 write_date(':');
51 2 write_date(time[now_time[0]>>4]);
52 2 write_date(time[now_time[0]&0x0f]);
53 2 if(key==2)
54 2 {
C51 COMPILER V7.50 DDS 06/17/2008 08:02:25 PAGE 2
55 3
56 3 sum=0;
57 3 book();
58 3
59 3 }
60 2 if(key==1)
61 2 {
62 3 music();
63 3
64 3 }
65 2 if(key==3)
66 2 {
67 3 alamn();
68 3
69 3 }
70 2 if(key==0)
71 2 {
72 3 time_set();
73 3
74 3 }
75 2 }
76 1 }
77 void detect()
78 {
79 1 uchar temp;
80 1 temp=P1;
81 1 temp=temp&0x0f;
82 1 if(temp!=0x0f)
83 1 {
84 2 switch(temp)
85 2 {
86 3 case 0x0e:
87 3 while(temp!=0x0f)
88 3 {
89 4 temp=P1;
90 4 temp=temp&0x0f;
91 4 }
92 3 if(key==0)
93 3 {
94 4 key=4;
95 4 }
96 3 key--;
97 3 flag=1;
98 3 write_order(0x01);
99 3 break;
100 3 case 0x0d:
101 3 while(temp!=0x0f)
102 3 {
103 4 temp=P1;
104 4 temp=temp&0x0f;
105 4 }
106 3 key++;
107 3 flag=2;
108 3 if(key==4)
109 3 {
110 4 key=0;
111 4 }
112 3 write_order(0x01);
113 3 break;
114 3 case 0x0b:
115 3 while(temp!=0x0f)
116 3 {
C51 COMPILER V7.50 DDS 06/17/2008 08:02:25 PAGE 3
117 4 temp=P1;
118 4 temp=temp&0x0f;
119 4 }
120 3 flag=3;
121 3 write_order(0x01);
122 3 break;
123 3 case 0x07:
124 3 while(temp!=0x0f)
125 3 {
126 4 temp=P1;
127 4 temp=temp&0x0f;
128 4 }
129 3 flag=4;
130 3 write_order(0x01);
131 3 break;
132 3 }
133 2 }
134 1
135 1 }
136 void page(uchar k)
137 {
138 1 write_order(0x80);
139 1 for(i=k*32;i<k*32+16&&str[i]!='\0';i++)
140 1 {
141 2 write_date(str[i]);
142 2 }
143 1 write_order(0x80+0x40);
144 1 for(i=k*32+16;i<k*32+32&&str[i]!='\0';i++)
145 1 {
146 2 write_date(str[i]);
147 2 }
148 1 }
149
150 void book()
151 {
152 1
153 1 flag=0;
154 1 detect();
155 1 if(flag==3)
156 1 {
157 2 flag=0;
158 2 page(sum);
159 2 while(flag!=4)
160 2 {
161 3 detect();
162 3 if(flag==1)
163 3 {
164 4 flag=0;
165 4 if(sum!=0)
166 4 {
167 5 sum--;
168 5 }
169 4 page(sum);
170 4 }
171 3 if(flag==2)
172 3 {
173 4 flag=0;
174 4 if(sum<5)
175 4 {
176 5 sum++;
177 5 }
178 4 page(sum);
C51 COMPILER V7.50 DDS 06/17/2008 08:02:25 PAGE 4
179 4 }
180 3 }
181 2 key=2;
182 2 }
183 1 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -