?? lcd.lst
字號(hào):
175 void LcdDataWrite (uchar u8Data,uchar u8LcdSide)
176 {
177 1 LcdWaitBusy (u8LcdSide);
178 1 A0=1;
179 1 R_W=0;/*寫數(shù)據(jù)指令*/
C51 COMPILER V7.06 LCD 11/21/2006 12:57:18 PAGE 4
180 1 LcdData=u8Data;
181 1 if(u8LcdSide==Left)
182 1 {
183 2 E1=1;
184 2 LcdData=u8Data;
185 2 E1=0;/*屏處于未選狀態(tài)*/
186 2 }
187 1 else
188 1 {
189 2 E2=1;
190 2 LcdData=u8Data;
191 2 E2=0;/*屏處于未選狀態(tài)*/
192 2 }
193 1
194 1 }
195
196 /********************清屏子程序********************/
197 void Clearlcd()
198 {
199 1 uchar data i,j,Disp_Page;
200 1 for(i=0;i<4;i++)
201 1 {
202 2 Disp_Page=i|0xb8;/*設(shè)置頁(yè)地址*/
203 2 LcdInstructionWrite(Disp_Page,Left); /*送入左半屏*/
204 2 LcdInstructionWrite(0x00,Left); /*設(shè)置列地址*/
205 2 /*左半屏清屏*/
206 2 for(j=0;j<61;j++)
207 2 {
208 3 LcdDataWrite(0x00,Left);
209 3 }
210 2 }
211 1 for(i=0;i<4;i++)
212 1 {
213 2 Disp_Page=i|0xb8;/*設(shè)置頁(yè)地址*/
214 2 LcdInstructionWrite(Disp_Page,Right); /*送入右半屏*/
215 2 LcdInstructionWrite(0x00,Right);/*設(shè)置列地址*/
216 2 /*右半屏清屏*/
217 2 for(j=0;j<61;j++)
218 2 {
219 3 LcdDataWrite(0x00,Right);
220 3 }
221 2 }
222 1 }
223 /********************初始化子程序********************/
224 void GLCD_LcdInit()
225 {
226 1 P0=0xff;
227 1 P1=0xff;
228 1 P2=0xff;
229 1 P3=0xff;
230 1 E1=0;
231 1 E2=0; /*屏幕處于未選狀態(tài)*/
232 1 Delay();
233 1 /*復(fù)位*/
234 1 LcdInstructionWrite(0xE2,Left);
235 1 LcdInstructionWrite(0xE2,Right);
236 1
237 1 /*正常工作狀態(tài)設(shè)置*/
238 1 LcdInstructionWrite(0xA4,Left);
239 1 LcdInstructionWrite(0xA4,Right);
240 1
241 1 /*占空比選擇*/
C51 COMPILER V7.06 LCD 11/21/2006 12:57:18 PAGE 5
242 1 LcdInstructionWrite(0xA9,Left);
243 1 LcdInstructionWrite(0xA9,Right);
244 1
245 1 /*ADC選擇指令*/
246 1 LcdInstructionWrite(0xA0,Left);
247 1 LcdInstructionWrite(0xA0,Right);
248 1
249 1 /*關(guān)顯示指令*/
250 1 LcdInstructionWrite(0xAE,Left);
251 1 LcdInstructionWrite(0xAE,Right);
252 1 /*設(shè)置起始行*/
253 1 LcdInstructionWrite(0xC0,Left);
254 1 LcdInstructionWrite(0xC0,Right);
255 1
256 1 LcdInstructionWrite(0xe0,Left);
257 1 LcdInstructionWrite(0xee,Left);
258 1
259 1 LcdInstructionWrite(0xe0,Right);
260 1 LcdInstructionWrite(0xee,Right);
261 1
262 1 Clearlcd();
263 1 /*開顯示指令*/
264 1 LcdInstructionWrite(0xAF,Left);
265 1 LcdInstructionWrite(0xAF,Right);
266 1
267 1 }
268 /********************延時(shí)子程序********************/
269 void Delay()
270 {
271 1 uchar data i,j;
272 1 for(i=0;i<255;i++)
273 1 for(j=0;j<255;j++);
274 1 }
275
276
277 /********************漢字子程序********************/
278
279 //寫單字節(jié)
280 void GLCD_Write_Byte (uchar u8Byte)
281 {
282 1 if(Column<61)
283 1 {
284 2 LcdInstructionWrite(0xe0,Left);
285 2 LcdInstructionWrite(0xee,Left);
286 2 /*設(shè)置頁(yè)地址*/
287 2 LcdInstructionWrite(Page|0xb8,Left);
288 2 /*設(shè)置頁(yè)地址*/
289 2 LcdInstructionWrite(Column|0x00,Left);
290 2 LcdDataWrite (u8Byte,Left);
291 2 }
292 1 else
293 1 {
294 2 LcdInstructionWrite(0xe0,Right);
295 2 LcdInstructionWrite(0xee,Right);
296 2 LcdInstructionWrite(Page|0xb8,Right);
297 2 LcdInstructionWrite((Column-61)|0x00,Right);
298 2 LcdDataWrite (u8Byte,Right);
299 2 }
300 1 }
301
302 /********************漢字主程序********************/
303 //顯示漢字
C51 COMPILER V7.06 LCD 11/21/2006 12:57:18 PAGE 6
304 void DisPlayChina(uchar Clore,uchar *Point)
305 {
306 1 uchar *PointBuff;
307 1 uchar i;
308 1 uchar j;
309 1 uchar ColumnBuff=Column;
310 1 uchar PageBuff=Page;
311 1
312 1 PointBuff=Point;
313 1 //顯示一個(gè)字符
314 1
315 1 for(i=0;i<2;i++)
316 1 {
317 2 for(j=0;j<16;j++)
318 2 {
319 3
320 3 if(Clore==Color)
321 3 {
322 4 GLCD_Write_Byte(PointBuff[16*i+j]) ;
323 4 }
324 3 else
325 3 {
326 4 GLCD_Write_Byte(0xFF^PointBuff[16*i+j]);
327 4 }
328 3
329 3 Column++;
330 3 }
331 2 Page++;
332 2 Column=ColumnBuff;
333 2 }
334 1
335 1 Page=PageBuff; //下一顯示字符的Page
336 1 Column+=16;
337 1 }
338
339
340
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 468 ----
CONSTANT SIZE = 604 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 3 8
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -