?? 帶農(nóng)歷帶生肖.lst
字號(hào):
C51 COMPILER V8.08 確農(nóng)繽確蒧肖 01/25/2009 10:21:59 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE 確農(nóng)繽確蒧肖
OBJECT MODULE PLACED IN 帶農(nóng)歷帶生肖.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 帶農(nóng)歷帶生肖.c BROWSE DEBUG OBJECTEXTEND
line level source
1 //頭文件
2 #include <REG52.h>
3 #include <string.h>
4 #include <intrins.h>
5
6 #define uint unsigned int
7 #define uchar unsigned char
8 /*****************************************************************************/
9
10
11
12 sbit LCM_cs = P2^5;
13 sbit LCM_std = P2^6;
14 sbit LCM_sclk = P2^7;
15 sbit LCM_psb = P2^3; //H=并口; L=串口;
16 sbit LCM_rst = P2^4; //Reset Signal 低電平有效
17
18
19 sbit beep = P1^2;
20 /*****************************************************************************/
21 //溫度傳感器定義
22 sbit DQ = P1^ 0;//ds18B20
23 /*****************************************************************************/
24 //鍵盤引腳定義
25 sbit KEY_1 = P3^4; //左上
26 sbit KEY_2 = P3^5; //左下
27 sbit KEY_3 = P3^6; //右上
28 sbit KEY_4 = P3^7; //右下
29
30 //定義DS1302時(shí)鐘接口
31 sbit DS1302_CLK = P1^3; //實(shí)時(shí)時(shí)鐘時(shí)鐘線引腳
32 sbit DS1302_IO = P1^4; //實(shí)時(shí)時(shí)鐘數(shù)據(jù)線引腳
33 sbit DS1302_RST = P1^7; //實(shí)時(shí)時(shí)鐘復(fù)位線引腳/***********************************************
-******************************/
34 //定義累加器A中的各位
35 sbit ACC0 = ACC^0;
36 sbit ACC7 = ACC^7;
37 /*****************************************************************************/
38 //定義全局變量
39 unsigned char yy,mo,dd,xq,hh,mm,ss,e;//定義時(shí)間映射全局變量(專用寄存器)
40
41 bit c_moon;
42 data uchar year_moon,month_moon,day_moon,week;
43
44 bit w = 0; //調(diào)時(shí)標(biāo)志位
45 static unsigned char menu = 0;//定義靜態(tài)小時(shí)更新用數(shù)據(jù)變量
46 static unsigned char keys = 0;//定義靜態(tài)小時(shí)更新用數(shù)據(jù)變量
47 static unsigned char timecount = 0;//定義靜態(tài)軟件計(jì)數(shù)器變量
48 uchar code tab1[]={
49 " 電子萬年歷 "
50 " 版本: V1.0 "
51 "2008年11月22日夜"
52 " 張強(qiáng) "
53 };
54 /****************************************************************************/
C51 COMPILER V8.08 確農(nóng)繽確蒧肖 01/25/2009 10:21:59 PAGE 2
55 void DelayM(unsigned int a) //延時(shí)函數(shù) 1MS/次
56 {
57 1 unsigned char i;
58 1 while( --a != 0)
59 1 {
60 2 for(i = 0; i < 125; i++); //一個(gè) ; 表示空語句,CPU空轉(zhuǎn)。
61 2 } //i 從0加到125,CPU大概就耗時(shí)1毫秒
62 1 }
63 /****************************************************************************/
64 //函數(shù)聲明
65 void LCM_WriteString(unsigned char *str) ; //寫字符 例:LCM_WriteString("您好!");
66 void LCM_WriteDatOrCom(bit ,unsigned char ); //(0,指令) (1,數(shù)據(jù))
67 void LCM_w_byte(unsigned char bbyte); //寫一個(gè)字節(jié)給LCM
68 void delaynms(unsigned int di); //延時(shí)
69 void LCM_init(void); //LCM初始化
70 void LCM_clr(void); //清屏
71 void Delay(int num);
72 bit get_moon_day(uchar month_p,uint table_addr);
73 void Conversion(bit c,uchar year,uchar month,uchar day);
74 void nl();
75 void days (viod) //公歷節(jié)日數(shù)據(jù)庫
76 {
77 1
78 1 LCM_WriteDatOrCom(0,0x80);
79 1 // LCM_WriteString("[Dis] [Set]");
80 1
81 1 LCM_WriteDatOrCom(0,0x98);
82 1 // ----|----------------|
83 1
84 1 if ( mo == 0x01 && dd == 0x01 ){ LCM_WriteString("Happy New Year!!"); }//1月
85 1 if ( mo == 0x01 && dd == 0x28 ){ LCM_WriteString(" 世界麻風(fēng)日 "); }
86 1 if (month_moon== 0x01 && day_moon == 0x01 ){ LCM_WriteString(" 今日春節(jié) "); }
-
87 1 if (month_moon== 0x01 && day_moon == 0x15 ){ LCM_WriteString(" 元宵節(jié)快樂 "); }
88 1
89 1
90 1 if (month_moon== 0x02 && day_moon == 0x02 ){ LCM_WriteString(" 青龍節(jié) "); }
91 1 if ( mo == 0x02 && dd == 0x02 ){ LCM_WriteString(" 世界濕地日 "); }//2月
92 1 if ( mo == 0x02 && dd == 0x13 ){ LCM_WriteString(" 明天情人節(jié)了 "); }
93 1 if ( mo == 0x02 && dd == 0x14 ){ LCM_WriteString(" 今天是情人節(jié) "); }
94 1
95 1 if ( mo == 0x03 && dd == 0x01 ){ LCM_WriteString(" 國際海豹日 "); }//3月
96 1 if ( mo == 0x03 && dd == 0x03 ){ LCM_WriteString(" 全國愛耳日 "); }
97 1 if ( mo == 0x03 && dd == 0x08 ){ LCM_WriteString(" 3.8婦女節(jié) "); }
98 1 if ( mo == 0x03 && dd == 0x12 ){ LCM_WriteString(" 植樹節(jié) "); }
99 1 if ( mo == 0x03 && dd == 0x14 ){ LCM_WriteString(" 國際警察日 "); }
100 1 if ( mo == 0x03 && dd == 0x15 ){ LCM_WriteString(" 消費(fèi)者權(quán)益日 "); }
101 1 if ( mo == 0x03 && dd == 0x17 ){ LCM_WriteString(" 國際航海日 "); }
102 1 if ( mo == 0x03 && dd == 0x21 ){ LCM_WriteString(" 世界森林日 "); }
103 1 if ( mo == 0x03 && dd == 0x22 ){ LCM_WriteString(" 世界水日 "); }
104 1 if ( mo == 0x03 && dd == 0x23 ){ LCM_WriteString(" 世界氣象日 "); }
105 1 if ( mo == 0x03 && dd == 0x24 ){ LCM_WriteString("世界防治結(jié)核病日"); }
106 1
107 1 if ( mo == 0x04 && dd == 0x01 ){ LCM_WriteString("愚人節(jié) 小心上當(dāng)"); }//4
108 1 if ( mo == 0x04 && dd == 0x07 ){ LCM_WriteString(" 世界衛(wèi)生日 "); }
109 1 if ( mo == 0x04 && dd == 0x08 ){ LCM_WriteString(" 復(fù)活節(jié) "); }
110 1 if ( mo == 0x04 && dd == 0x13 ){ LCM_WriteString(" 黑色星期五 "); }
111 1
112 1 if (month_moon== 0x05 && day_moon == 0x05 ){ LCM_WriteString(" 端午節(jié) "); }
113 1 if ( mo == 0x05 && dd == 0x01 ){ LCM_WriteString(" 勞動(dòng)節(jié) 放假 "); }//5
114 1 if ( mo == 0x05 && dd == 0x04 ){ LCM_WriteString(" 青年節(jié) "); }
115 1 if ( mo == 0x05 && dd == 0x08 ){ LCM_WriteString(" 世界紅十字日 "); }
C51 COMPILER V8.08 確農(nóng)繽確蒧肖 01/25/2009 10:21:59 PAGE 3
116 1 if ( mo == 0x05 && dd == 0x12 ){ LCM_WriteString(" 國際護(hù)士節(jié) "); }
117 1 if ( mo == 0x05 && dd == 0x05 ){ LCM_WriteString("近日注意母親節(jié) "); }
118 1 if ( mo == 0x05 && dd == 0x15 ){ LCM_WriteString(" 國際家庭日 "); }
119 1 if ( mo == 0x05 && dd == 0x31 ){ LCM_WriteString(" 世界無煙日 "); }
120 1
121 1 if ( mo == 0x06 && dd == 0x01 ){ LCM_WriteString(" 國際兒童節(jié) "); }//6
122 1 if ( mo == 0x06 && dd == 0x05 ){ LCM_WriteString(" 世界環(huán)境日 "); }
123 1 if ( mo == 0x06 && dd == 0x26 ){ LCM_WriteString(" 國際禁毒日 "); }
124 1 if ( mo == 0x06 && dd == 0x06 ){ LCM_WriteString(" 全國愛眼日 "); }
125 1 if ( mo == 0x06 && dd == 0x13 ){ LCM_WriteString("近日注意父親節(jié) "); }
126 1 if ( mo == 0x06 && dd == 0x15 ){ LCM_WriteString("近日注意父親節(jié) "); }
127 1
128 1 if (month_moon== 0x07 && day_moon == 0x07 ){ LCM_WriteString("乞巧節(jié)中國情人節(jié)"); }
129 1 if (month_moon== 0x07 && day_moon == 0x15 ){ LCM_WriteString(" 中元節(jié) "); }
130 1 if ( mo == 0x07 && dd == 0x01 ){ LCM_WriteString("香港回歸記念日 "); }//7
131 1 if ( mo == 0x07 && dd == 0x07 ){ LCM_WriteString("抗日戰(zhàn)爭記念日 "); }
132 1 if ( mo == 0x07 && dd == 0x11 ){ LCM_WriteString(" 世界人口日 "); }
133 1
134 1 if (month_moon== 0x08 && day_moon == 0x15 ){ LCM_WriteString(" 中秋節(jié)快樂 "); }
135 1 if ( mo == 0x08 && dd == 0x01 ){ LCM_WriteString(" 八一建軍節(jié) "); }//8
136 1 if ( mo == 0x08 && dd == 0x08 ){ LCM_WriteString(" 中國男子節(jié) "); }
137 1 if ( mo == 0x08 && dd == 0x15 ){ LCM_WriteString("抗戰(zhàn)勝利記念日 "); }
138 1
139 1 if (month_moon== 0x09 && day_moon == 0x09 ){ LCM_WriteString(" 今日重陽節(jié) "); }
140 1 if ( mo == 0x09 && dd == 0x10 ){ LCM_WriteString(" 中國教師節(jié) "); }//9
141 1 if ( mo == 0x09 && dd == 0x18 ){ LCM_WriteString("九·一八事變記念"); }
142 1 if ( mo == 0x09 && dd == 0x20 ){ LCM_WriteString(" 國際愛牙日 "); }
143 1 if ( mo == 0x09 && dd == 0x27 ){ LCM_WriteString(" 世界旅游日 "); }
144 1
145 1 if ( mo == 0x10 && dd == 0x01 ){ LCM_WriteString(" 中國國慶節(jié) "); }//10
146 1 if ( mo == 0x10 && dd == 0x04 ){ LCM_WriteString(" 世界動(dòng)物日 "); }
147 1 if ( mo == 0x10 && dd == 0x24 ){ LCM_WriteString(" 聯(lián)合國日 "); }
148 1 if ( mo == 0x10 && dd == 0x12 ){ LCM_WriteString("明天國際教師節(jié) "); }
149 1 if ( mo == 0x10 && dd == 0x13 ){ LCM_WriteString(" 國際教師節(jié) "); }
150 1
151 1 if ( mo == 0x11 && dd == 0x10 ){ LCM_WriteString(" 世界青年節(jié) "); }//11
152 1 if ( mo == 0x11 && dd == 0x17 ){ LCM_WriteString(" 世界學(xué)生節(jié) "); }
153 1
154 1 if (month_moon== 0x12 && day_moon == 0x08 ){ LCM_WriteString(" 今日臘八節(jié) "); }
155 1 if (month_moon== 0x12 && day_moon == 0x15 ){ LCM_WriteString(" 過小年 "); }
156 1 if (month_moon== 0x12 && day_moon == 0x29 ){ LCM_WriteString(" 臘月二十九 "); }
157 1 if (month_moon== 0x12 && day_moon == 0x30 ){ LCM_WriteString(" 大年三十(^o^) "); }
158 1 if ( mo == 0x12 && dd == 0x01 ){ LCM_WriteString(" 世界艾滋病日 "); }//12
159 1 if ( mo == 0x12 && dd == 0x23 ){ LCM_WriteString(" 明晚平安夜 "); }
160 1 if ( mo == 0x12 && dd == 0x24 ){ LCM_WriteString(" 今晚平安夜 "); }
161 1 if ( mo == 0x12 && dd == 0x25 ){ LCM_WriteString(" 圣誕快樂 "); }
162 1 if ( mo == 0x12 && dd == 0x31 ){ LCM_WriteString(" 明日新年 "); }
163 1
164 1 else{
165 2 if ( hh >= 0x04 && hh < 0x06 ){ LCM_WriteString("★★__▲▲__凌晨"); }
166 2 if ( hh >= 0x06 && hh < 0x08 ){ LCM_WriteString("☆○__▲△__早晨"); }
167 2 if ( hh >= 0x08 && hh < 0x12 ){ LCM_WriteString("__●__▲▲__上午"); }
168 2 if ( hh == 0x12) { LCM_WriteString("____▲●▲__中午"); }
169 2 if ( hh >= 0x13 && hh < 0x18 ){ LCM_WriteString("__▲▲__●__下午"); }
170 2 if ( hh >= 0x18 && hh < 0x22 ){ LCM_WriteString("△▲__●☆__晚上"); }
171 2 if ( hh >= 0x22 && hh <= 0x23 ){ LCM_WriteString("△▲__★☆__夜里"); }
172 2 if ( hh >= 0x00 && hh < 0x04 ){ LCM_WriteString("__★▲▲★__深夜"); }
173 2 }
174 1
175 1
176 1
177 1 }
C51 COMPILER V8.08 確農(nóng)繽確蒧肖 01/25/2009 10:21:59 PAGE 4
178 /****************************************************************************/
179 //初始化LCM
180 void LCM_init(void)
181 {
182 1 LCM_rst=1;
183 1 LCM_psb=0;
184 1 LCM_WriteDatOrCom (0,0x30); /*30---基本指令動(dòng)作*/
185 1 LCM_WriteDatOrCom (0,0x01); /*清屏,地址指針指向00H*/
186 1 Delay (100);
187 1 LCM_WriteDatOrCom (0,0x06); /*光標(biāo)的移動(dòng)方向*/
188 1 LCM_WriteDatOrCom(0,0x0c); /*開顯示,關(guān)游標(biāo)*/
189 1
190 1 }
191 /******************************************************************************/
192 //寫指令或數(shù)據(jù) (0,指令) (1,數(shù)據(jù))
193 void LCM_WriteDatOrCom(bit dat_comm,uchar content)
194 {
195 1 uchar a,i,j;
196 1 Delay(50);
197 1 a=content;
198 1 LCM_cs=1;
199 1 LCM_sclk=0;
200 1 LCM_std=1;
201 1 for(i=0;i<5;i++)
202 1 {
203 2 LCM_sclk=1;
204 2 LCM_sclk=0;
205 2 }
206 1 LCM_std=0;
207 1 LCM_sclk=1;
208 1 LCM_sclk=0;
209 1 if(dat_comm)
210 1 LCM_std=1; //data
211 1 else
212 1 LCM_std=0; //command
213 1 LCM_sclk=1;
214 1 LCM_sclk=0;
215 1 LCM_std=0;
216 1 LCM_sclk=1;
217 1 LCM_sclk=0;
218 1 for(j=0;j<2;j++)
219 1 {
220 2 for(i=0;i<4;i++)
221 2 {
222 3 a=a<<1;
223 3 LCM_std=CY;
224 3 LCM_sclk=1;
225 3 LCM_sclk=0;
226 3 }
227 2 LCM_std=0;
228 2 for(i=0;i<4;i++)
229 2 {
230 3 LCM_sclk=1;
231 3 LCM_sclk=0;
232 3 }
233 2 }
234 1 }
235 /*********************************************************************************/
236 void chn_disp (uchar code *chn)
237 {
238 1 uchar i,j;
239 1 LCM_WriteDatOrCom (0,0x30);
C51 COMPILER V8.08 確農(nóng)繽確蒧肖 01/25/2009 10:21:59 PAGE 5
240 1 LCM_WriteDatOrCom (0,0x80);
241 1 for (j=0;j<4;j++)
242 1 {
243 2 for (i=0;i<16;i++)
244 2 LCM_WriteDatOrCom (1,chn[j*16+i]);
245 2 }
246 1 }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -