📄 lcd.lst
字号:
242 2 if(fontsize == FONTSIZE_8x8) {
243 3 if(lcd_putc_8x8(x, y, *str++)) {
244 4 x += 6;
245 4 n++;
246 4 }
247 3 }
248 2 else
249 2 {
250 3 if((fontsize == FONTSIZE_8x16) ||
251 3 (fontsize == FONTSIZE_HYPER && r1 != 1 && *str <= 0x80))
252 3 {
253 4 if(lcd_putc_8x16(x, y, *str++))
254 4 {
255 5 x += 8;
256 5 n++;
257 5 }
258 4 continue;
259 4 }
260 3 r1 = api_s8GetFont16x16BMP(*str++, FALSE);
261 3 if(r1 == 0)
262 3 {
263 4 if(lcd_putc_16x16(x, y, 0))
264 4 {
265 5 x += 16;
266 5 n += 2;
267 5 }
268 4 }
269 3 }
270 2 }
271 1 }
272
273 void lcd_puts_unicode(UINT8 x, UINT8 y, UINT16 *str, UINT8 fontsize)
274 {
275 1 UINT8 data n;
276 1 n = 0;
277 1 while(*str != '\0')
278 1 {
279 2 if(n >= lcd_max_str)
280 2 return;
281 2
282 2 if(fontsize == FONTSIZE_8x8)
283 2 {
284 3 if(lcd_putc_8x8(x, y, *str++))
285 3 {
286 4 x += 6;
287 4 n++;
288 4 }
289 3 }
290 2 else {
291 3 if((fontsize == FONTSIZE_8x16) ||
292 3 (fontsize == FONTSIZE_HYPER && *str <= 0x80))
293 3 {
294 4 if(lcd_putc_8x16(x, y, *str++))
295 4 {
296 5 x += 8;
297 5 n++;
298 5 }
299 4 continue;
300 4 }
301 3 if(lcd_putc_16x16(x, y, *str++))
C51 COMPILER V7.50 LCD 09/05/2008 09:54:27 PAGE 6
302 3 {
303 4 x += 16;
304 4 n += 2;
305 4 }
306 3 }
307 2 }
308 1 }
309
310 void lcd_clear(void)
311 {
312 1 UINT8 i;
313 1
314 1 lcd_set_rw_area(0, 0, XRES, YRES);
315 1
316 1 memset(pixel_buf, 0x0, sizeof(pixel_buf));
317 1
318 1 for(i = 0; i < YRES; i++)
319 1 lcd_put_data((UINT16)pixel_buf, XRES << 1);
320 1 }
321 void lcd_clear_word(void)
322 {
323 1 UINT8 i;
324 1
325 1 lcd_set_rw_area(50, 74, 54, 80);
326 1
327 1 memset(pixel_buf, 0xF77F, sizeof(pixel_buf));
328 1
329 1 for(i = 96; i < 102; i++)
330 1 lcd_put_data((UINT16)pixel_buf, XRES << 1);
331 1 }
332
333 void lcd_set_brightness(UINT8 v)
334 {
335 1 #if 1
336 1 api_vLcdPinSelect();
337 1 writec(0x2a);
338 1 writec(0xce+v); //90 0xde c8
339 1 delay(20);
340 1 writec(0x2b);
341 1 writec(0x44+v); //90 0x54 c8
342 1 api_vLcdPinRecover();
343 1 #else
api_vLcdPinSelect();
writec(0x2a);
writec(v*8); //90 0xde c8
delay(20);
writec(0x2b);
writec(v*8); //90 0x54 c8
api_vLcdPinRecover();
#endif
352 1 }
353
354 void lcd_init(void)
355 {
356 1 // CDIR = 1;
357 1 // Print("LCD Init\n");
358 1 api_vLcdInit(LCM_INTERFACE_8080);
359 1 api_vLcdPinSelect();
360 1 bLCD_PIN_RESET = 0;
361 1 delay(100);
362 1 bLCD_PIN_RESET = 1;
363 1
C51 COMPILER V7.50 LCD 09/05/2008 09:54:27 PAGE 7
364 1 delay(100);
365 1 //-------------------------------------------------
366 1 writec(0x2C);
367 1 delay(20);
368 1 //-------------------------------------------------
369 1 writec(0x02);
370 1 writec(0x01);
371 1 delay(20);
372 1 //-------------------------------------------------
373 1 writec(0x26);
374 1 writec(0x01);
375 1 delay(20);
376 1 writec(0x26);
377 1 writec(0x09);
378 1 delay(20);
379 1 writec(0x26);
380 1 writec(0x0b);
381 1 delay(20);
382 1 writec(0x26);
383 1 writec(0x0f);
384 1 delay(20);
385 1 //------------------------------------------------
386 1 writec(0x10);
387 1 writec(0x23); // 21,25
388 1 delay(5);
389 1 //-------------------------------------------------
390 1 writec(0x20);
391 1 writec(0x03); //20
392 1 delay(20);
393 1 //-------------------------------------------------
394 1 writec(0x22);
395 1 writec(0x11);
396 1 delay(5);
397 1 //------------------------------------------------
398 1 writec(0x24);
399 1 writec(0x11); //00
400 1 delay(20);
401 1 //-------------------------------------------------
402 1 writec(0x28);
403 1 writec(0x01);
404 1 delay(20);
405 1 /*******************对比度调节****************/
406 1 writec(0x2a);
407 1 writec(0xde); //90 0xde c8
408 1 delay(20);
409 1 writec(0x2b);
410 1 writec(0x54); //90 0x54 c8
411 1 delay(10);
412 1 /***************************************************/
413 1 writec(0x30);
414 1 writec(0x09); //0b
415 1 delay(20);
416 1 //------------------------------------------------
417 1 writec(0x32);
418 1 writec(0x0E);
419 1 delay(20);
420 1 //-----------------------------------------------
421 1 writec(0x34);
422 1 writec(0x08);//0d
423 1 delay(20);
424 1 //-------------------------------------------------
425 1 writec(0x36);
C51 COMPILER V7.50 LCD 09/05/2008 09:54:27 PAGE 8
426 1 writec(0x00);
427 1 delay(20);
428 1 /*********************显示模式******************/
429 1 writec(0x40);
430 1 writec(0x00);//显示模式08和 00相反 竖屏
431 1 writec(0x10);
432 1 writec(0x22);//扫描方式22和26相反 横屏
433 1 delay(20);
434 1 /****************************************************/
435 1 writec(0x43);
436 1 writec(0x00);
437 1 writec(0x7F);
438 1 delay(20);
439 1 //------------------------------------------------
440 1 writec(0x42);
441 1 writec(0x00);
442 1 writec(0x9F);
443 1 delay(20);
444 1 //------------------------------------------------
445 1 writec(0x53);
446 1 writec(0x00);
447 1 delay(20);
448 1
449 1
450 1
451 1
452 1
453 1 //-------------------------------------------------
454 1 writec(0xEB);
455 1 delay(20);
456 1 //-------------------------------------------------
457 1 writec(0x45);
458 1 writec(0x00);
459 1 //-------------------------------------------------
460 1 writec(0x55);
461 1 writec(0x00);
462 1 delay(20);
463 1 //------------------------------------------------
464 1 writec(0x5A);
465 1 writec(0x00);
466 1 delay(20);
467 1
468 1
469 1
470 1 //------------------------------------------------
471 1 writec(0x51);
472 1 delay(40);
473 1
474 1 api_vLcdPinRecover();
475 1 lcd_set_brightness(10);
476 1 }
477
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1713 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 773 39
PDATA SIZE = ---- ----
DATA SIZE = ---- 3
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
C51 COMPILER V7.50 LCD 09/05/2008 09:54:27 PAGE 9
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -