📄 lcd128x64.lst
字号:
318 2 case 2:
319 2 start_address = 0x88;
320 2 break;
321 2 case 3:
322 2 start_address = 0x98;
323 2 break;
324 2 default:
325 2 break;
326 2 }
327 1 for(count=0;count<8;count++){
328 2 lcd_Display_Lib_Chinese(start_address, 0xA1A0); //clear
329 2 start_address++;
330 2 }
331 1 }
332 //0x30---0x39
333 void lcd_Display_num_half_wide(BYTE startaddress, BYTE code_num1, BYTE code_num2)
334 { //显示半宽字符
335 1 lcd_Write_Cmd(0x80);
336 1 lcd_Write_Cmd(startaddress);
337 1
338 1 lcd_Write_Dat(code_num1); //the high byte
339 1 lcd_Write_Dat(code_num2); //the low byte
340 1 }
341
342 //*************************************//
343 //****以下新增显示单个字母子程序******//
344 //************************************//
345 void lcd_Display_num_single(BYTE startaddress, BYTE code_num1)
346 { //显示单个字母
347 1 lcd_Write_Cmd(0x80);
348 1 lcd_Write_Cmd(startaddress);
349 1 lcd_Write_Dat(code_num1);
350 1 }//*************END****************//
351 //-------------------------------------//
352 // 以下新增显示"请输入用户名"子函数 //
353 //------------------------------------//
354 /*
355 void lcd_Displzy_user_name_input(BYTE startaddress)//显示"请输入用户名"
356 {
357 lcd_Disp_Text_Line_Order(startaddress,tylx10);
358 startaddress += 2;
359 lcd_Display_Lib_Chinese(startaddress, 0xC7EB);//"请"
360 startaddress++;
361 lcd_Display_Lib_Chinese(startaddress, 0xCAE4);//"输"
362 startaddress++;
363 lcd_Display_Lib_Chinese(startaddress, 0xC8EB);//"入"
364 startaddress++;
365 lcd_Display_Lib_Chinese(startaddress, 0xD3C3);//"用"
C51 COMPILER V7.08 LCD128X64 03/05/2007 16:38:04 PAGE 7
366 startaddress++;
367 lcd_Display_Lib_Chinese(startaddress, 0xBBA7);//"户"
368 startaddress++;
369 lcd_Display_Lib_Chinese(startaddress, 0xC3FB);//"名"
370 startaddress++;
371 }//-------------END-------------------//
372 //-------------------------------------//
373 // 新增显示"请输入类别名"子函数 //
374 //------------------------------------//
375 void lcd_Displzy_type_name_input(BYTE startaddress)//显示"请输入类别名"
376 {
377 lcd_Disp_Text_Line_Order(startaddress,tylx10);
378 startaddress += 2;
379 lcd_Display_Lib_Chinese(startaddress, 0xC7EB);//"请"
380 startaddress++;
381 lcd_Display_Lib_Chinese(startaddress, 0xCAE4);//"输"
382 startaddress++;
383 lcd_Display_Lib_Chinese(startaddress, 0xC8EB);//"入"
384 startaddress++;
385 lcd_Display_Lib_Chinese(startaddress, 0xC0E0);//"类"
386 startaddress++;
387 lcd_Display_Lib_Chinese(startaddress, 0xB1F0);//"别"
388 startaddress++;
389 lcd_Display_Lib_Chinese(startaddress, 0xC3FB);//"名"
390 startaddress++;
391 }//-------------END-------------------//
392 */
393
394 void lcd_Display_time(BYTE startaddress) //显示时间
395 {
396 1 lcd_Disp_Text_Line_Order(startaddress,tylx10);
397 1 startaddress += 2;
398 1 lcd_Display_num_half_wide(startaddress, hour_buffer.shiwei, hour_buffer.gewei);//hour
399 1 startaddress++;
400 1 lcd_Display_Lib_Chinese(startaddress, 0xCAB1);
401 1 startaddress++;
402 1 lcd_Display_num_half_wide(startaddress, minute_buffer.shiwei, minute_buffer.gewei);
403 1 startaddress++;
404 1 lcd_Display_Lib_Chinese(startaddress, 0xB7D6);
405 1 startaddress++;
406 1 lcd_Display_num_half_wide(startaddress, second_buffer.shiwei, second_buffer.gewei);
407 1 startaddress++;
408 1 lcd_Display_Lib_Chinese(startaddress, 0xC3EB);
409 1 }
410
411 void lcd_Display_date(BYTE startaddress) //显示日期
412 {
413 1 lcd_Disp_Text_Line_Order(startaddress,tylx9);
414 1 startaddress += 2;
415 1 lcd_Display_num_half_wide(startaddress, year_buffer.shiwei, year_buffer.gewei);//hour
416 1 startaddress++;
417 1 lcd_Display_Lib_Chinese(startaddress, 0xC4EA);
418 1 startaddress++;
419 1 lcd_Display_num_half_wide(startaddress, month_buffer.shiwei, month_buffer.gewei);
420 1 startaddress++;
421 1 lcd_Display_Lib_Chinese(startaddress, 0xD4C2);
422 1 startaddress++;
423 1 lcd_Display_num_half_wide(startaddress, day_buffer.shiwei, day_buffer.gewei);
424 1 startaddress++;
425 1 lcd_Display_Lib_Chinese(startaddress, 0xC8D5);
426 1 }
427
C51 COMPILER V7.08 LCD128X64 03/05/2007 16:38:04 PAGE 8
428 void lcd_Display_week(BYTE startaddress) //显示星期
429 {
430 1 lcd_Display_Lib_Chinese(startaddress, 0xD0C7);
431 1 startaddress++;
432 1 lcd_Display_Lib_Chinese(startaddress, 0xC6DA);
433 1 startaddress++;
434 1 lcd_Display_num_half_wide(startaddress, week_buffer.shiwei, week_buffer.gewei);
435 1 }
436
437 void lcd_Display_zongci(BYTE startaddress) //显示总次
438 {
439 1
440 1 disp_num_address_1 save_num_buffer;
441 1 BYTE tem_1,tem_2;
442 1
443 1 tem_1 = save_current_num / 100;
444 1 tem_2 = save_current_num - tem_1 * 100;
445 1 save_num_buffer.baiwei = 0x30 + tem_1;
446 1 save_num_buffer.shiwei = 0x30 + tem_2/10;
447 1 save_num_buffer.gewei = 0x30 + (save_current_num - tem_1 * 100 - (tem_2/10) * 10);
448 1 lcd_Disp_Text_Line_Order(startaddress,tylx6); //chinese
449 1 startaddress += (2 + 1);
450 1 lcd_Display_num_half_wide(startaddress, save_num_buffer.baiwei, save_num_buffer.shiwei);
451 1 startaddress++;
452 1 lcd_Display_num_half_wide(startaddress, save_num_buffer.gewei, 0x20);
453 1 }
454
455 void lcd_Display_leibie(BYTE startaddress) //显示类别
456 {
457 1 BYTE tem_1,tem_2;
458 1
459 1 tem_1 = save_tem_type / 100;
460 1 tem_2 = save_tem_type - tem_1 * 100;
461 1 save_type_buffer.baiwei = 0x30 + tem_1;
462 1 save_type_buffer.shiwei = 0x30 + tem_2/10;
463 1 save_type_buffer.gewei = 0x30 + (save_tem_type - tem_1 * 100 - (tem_2/10) * 10);
464 1 lcd_Disp_Text_Line_Order(startaddress,tylx7); //chinese
465 1 startaddress += (2 + 1);
466 1 lcd_Display_num_half_wide(startaddress, save_type_buffer.baiwei, save_type_buffer.shiwei);
467 1 startaddress++;
468 1 lcd_Display_num_half_wide(startaddress, save_type_buffer.gewei, 0x20);
469 1 }
470
471
472 void lcd_Display_pizhong(BYTE startaddress) //显示皮重
473 {
474 1 BYTE tem_1,tem_2;
475 1
476 1 tem_1 = save_tem_pizhong / 100;
477 1 tem_2 = save_tem_pizhong - tem_1 * 100;
478 1 save_pizhong_buffer.baiwei = 0x30 + tem_1;
479 1 save_pizhong_buffer.shiwei = 0x30 + tem_2/10;
480 1 save_pizhong_buffer.gewei = 0x30 + (save_tem_pizhong - tem_1 * 100 - (tem_2/10) * 10);
481 1 lcd_Disp_Text_Line_Order(startaddress,tylx8); //chinese
482 1 startaddress += (2 + 1);
483 1 lcd_Display_num_half_wide(startaddress, save_pizhong_buffer.baiwei, save_pizhong_buffer.shiwei);
484 1 startaddress++;
485 1 lcd_Display_num_half_wide(startaddress, save_pizhong_buffer.gewei, 0x20);
486 1
487 1 }
488
489 void lcd_Display_zongzhong(BYTE startaddress) //显示总重
C51 COMPILER V7.08 LCD128X64 03/05/2007 16:38:04 PAGE 9
490 {
491 1 set_zongzhong_num_address_bydata(all_weight);
492 1
493 1 lcd_Disp_Text_Line_Order(startaddress,tylx16); //chinese
494 1 startaddress += (2 + 1);
495 1 lcd_Display_num_half_wide(startaddress, save_type_buffer.baiwei, save_type_buffer.shiwei);
496 1 startaddress++;
497 1 lcd_Display_num_half_wide(startaddress, save_type_buffer.gewei, save_pizhong_buffer.baiwanwei);
498 1 startaddress++;
499 1 lcd_Display_num_half_wide(startaddress, save_pizhong_buffer.shiwanwei, save_pizhong_buffer.wanwei);
500 1 startaddress++;
501 1 lcd_Display_num_half_wide(startaddress, save_pizhong_buffer.qianwei, save_pizhong_buffer.baiwei);
502 1 startaddress++;
503 1 lcd_Display_num_half_wide(startaddress, save_pizhong_buffer.shiwei,save_pizhong_buffer.gewei);
504 1 }
505
506 void lcd_Display_usename(BYTE startaddress) //显示用户名
507 {
508 1 BYTE count;
509 1
510 1 lcd_Disp_Text_Line_Order(startaddress,tylx19); //chinese
511 1 startaddress += (2 + 1);
512 1 for(count = 0;count < 5;count++){
513 2 lcd_Display_Lib_Chinese(startaddress, save_tem_usename[count]);
514 2 startaddress++;
515 2 }
516 1 }
517
518 void lcd_Disp_Clear_pho(void)
519 { //液晶清屏,清图片
520 1 BYTE LCD_X, LCD_Y, COUNT1, COUNT2, COUNT3;
521 1
522 1 lcd_Write_Cmd(0x34);
523 1 lcd_Write_Cmd(0x30);
524 1
525 1 LCD_X = 0x80;
526 1
527 1 for(COUNT3 = 2;COUNT3 > 0;COUNT3--)
528 1 {
529 2 LCD_Y = 0x80;
530 2 for(COUNT2 = 32;COUNT2 > 0;COUNT2--)
531 2 {
532 3 lcd_Write_Cmd(0x34); // start to give address
533 3 lcd_Write_Cmd(LCD_Y);
534 3 lcd_Write_Cmd(LCD_X);
535 3 lcd_Write_Cmd(0x30);
536 3
537 3 for(COUNT1 = 16;COUNT1 > 0;COUNT1--)
538 3 {
539 4 lcd_Write_Dat(0x00);
540 4 }
541 3 LCD_Y++;
542 3 }
543 2 LCD_X = 0x88;
544 2 }
545 1 lcd_Write_Cmd(0x36);
546 1 lcd_Write_Cmd(0x30);
547 1 }
548
549 void lcd_Display_zhonglang(long int zhongliang) //显示重量(大字)
550 {
551 1 unsigned char i,str[6];
C51 COMPILER V7.08 LCD128X64 03/05/2007 16:38:04 PAGE 10
552 1
553 1 i=0;
554 1 //lcd_Disp_shuzi(shuzi_zimo_2,5);
555 1
556 1 str[5]=zhongliang/100000;
557 1 str[4]=(zhongliang-str[5]*100000)/10000;
558 1 str[3]=(zhongliang-str[5]*100000-str[4]*10000)/1000;
559 1 str[2]=(zhongliang-str[5]*100000-str[4]*10000-str[3]*1000)/100;
560 1 str[1]=(zhongliang-str[5]*100000-str[4]*10000-str[3]*1000-str[2]*100)/10;
561 1 str[0]=zhongliang-str[5]*100000-str[4]*10000-str[3]*1000-str[2]*100-str[1]*10;
562 1
563 1 for(i=5;i>0;i--)
564 1 {
565 2 if(str[i]==0)
566 2 {
567 3 str[i]=11;//显示空白
568 3 }
569 2 else goto loop1;
570 2 }
571 1 loop1:
572 1
573 1 //
574 1 // lcd_Write_Cmd(0x34);
575 1 //lcd_Write_Cmd(0x30);
576 1
577 1 //str[0]=0;str[1]=1;str[2]=11;str[3]=11;str[4]=11;str[5]=11;
578 1 for(i=0;i<6;++i)
579 1 {
580 2 //i=3;
581 2 if(str[i]==0)lcd_Disp_shuzi(shuzi_zimo_0,6-i);
582 2 if(str[i]==1)lcd_Disp_shuzi(shuzi_zimo_1,6-i);
583 2 if(str[i]==2)lcd_Disp_shuzi(shuzi_zimo_2,6-i);
584 2 if(str[i]==3)lcd_Disp_shuzi(shuzi_zimo_3,6-i);
585 2 if(str[i]==4)lcd_Disp_shuzi(shuzi_zimo_4,6-i);
586 2 if(str[i]==5)lcd_Disp_shuzi(shuzi_zimo_5,6-i);
587 2 if(str[i]==6)lcd_Disp_shuzi(shuzi_zimo_6,6-i);
588 2 if(str[i]==7)lcd_Disp_shuzi(shuzi_zimo_7,6-i);
589 2 if(str[i]==8)lcd_Disp_shuzi(shuzi_zimo_8,6-i);
590 2 if(str[i]==9)lcd_Disp_shuzi(shuzi_zimo_9,6-i);
591 2 if(str[i]==11)lcd_Disp_shuzi(shuzi_zimo_nop,6-i);
592 2
593 2 }
594 1
595 1 lcd_Write_Cmd(0x36);
596 1 //lcd_Write_Cmd(0x30);
597 1
598 1 }
599 void lcd_Disp_shuzi(BYTE *value,lie) //显示数字
600 {
601 1 BYTE LCD_X, LCD_Y, COUNT1, COUNT2, COUNT3;
602 1
603 1 LCD_X = 0x80+lie;
604 1
605 1 for(COUNT3 = 2;COUNT3 > 0;COUNT3--)
606 1 { //the section is divided into two parts
607 2 LCD_Y = 0x80; // both parts first line Y address
608 2 for(COUNT2 = 32;COUNT2 > 0;COUNT2--)
609 2 { //every part has 32 lines
610 3 //lcd_Write_Cmd(0x34); // start to give address
611 3 lcd_Write_Cmd(LCD_Y);
612 3 lcd_Write_Cmd(LCD_X);
613 3 //lcd_Write_Cmd(0x30);
C51 COMPILER V7.08 LCD128X64 03/05/2007 16:38:04 PAGE 11
614 3 for(COUNT1 = 2;COUNT1 > 0;COUNT1--)
615 3 {
616 4 lcd_Write_Dat(*value);
617 4 value++;
618 4 }
619 3 LCD_Y++; //line Y address add 1
620 3 }
621 2 LCD_X = 0x88+lie; // start the second part
622 2 }
623 1 //lcd_Write_Cmd(0x36);
624 1 //lcd_Write_Cmd(0x30);
625 1 }
626
627
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2535 ----
CONSTANT SIZE = 1827 ----
XDATA SIZE = 24 37
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- 1
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -