/* LCD_Demo.c: Demo program for G-4500 Object: To call LCD.lib function. Display the number, text and BIG-5 Code Set (Traditional Chinese) by the LCD. Compiler: BC++ 3.1 Turbo C ++ 1.01(3.01) Compile mode: large Project: LCD_Demo.c ..\..\Lib\G4500.lib ..\..\Lib\LCD.lib Hardware: G-4500 [02/Apr/2009] Modify by Yide [22/Feb/2008] Create by Liam */ //#define _MINIOS7_STUDIO_ #ifdef _MINIOS7_STUDIO_ #include #else #include #include "G4500.h" #include "LCD.h" #endif uchar mynew1[]={"Hello, ICP DAS!"}; uchar mynew2[]={"ªl®æ¬ì§Þ"}; uchar mynew3[]={" This is G-4500"}; void main(void) { int i, iAction, iLib; int iLine, iDisplay, iblink; char date[32]; InitLib(); LCD_Init(); Puts("\r\nDemo program for G-4500\r\n"); GetLibDate(date); iLib=GetLibVersion(); Print("G4500.lib vesion %X.%02X, Date:%s\r\n", iLib>>8, iLib&0xff, date); iLib=LCD_GetLibVersion(); Print("LCD.lib vesion %X.%02X\r\n", iLib>>8, iLib&0xff); while(iAction!=0) { Puts("\r\n"); Puts(" 1) Show strings on the LCD panel\r\n"); Puts(" 2) Reverse the display by line\r\n"); Puts(" 3) Restore the display by line\r\n"); Puts(" 4) Turn on the LCD backlight\r\n"); Puts(" 5) Turn off the LCD backlight\r\n"); Puts(" 6) Set the Cursor display status\r\n"); Puts(" 7) Clear the LCD panel\r\n"); Puts("\r\n"); Puts(" 0) Quits demo program\r\n\r\n"); Puts("Choose an option and press [Enter]: "); Scanf("%d", &iAction); Puts("\r\n"); if(iAction==1) { /* LCD_SetNumber(1, 1, 1); LCD_SetNumber(1, 2, 2); LCD_SetNumber(1, 3, 3); LCD_SetNumber(1, 4, 4); LCD_SetNumber(1, 5, 5); LCD_SetNumber(2, 1, 6); LCD_SetNumber(2, 2, 7); LCD_SetNumber(2, 3, 8); LCD_SetNumber(2, 4, 9); LCD_SetNumber(2, 5, 0); LCD_DisplayNumber(0); */ /* */ LCD_GotoPosition(1, 1); for(i=0; mynew1[i]!='\0'; i++) { LCD_ShowText(mynew1[i]); } Print("\r\n"); LCD_GotoPosition(2, 1); for(i=0; mynew2[i]!='\0'; i++) { LCD_ShowText(mynew2[i]); Print("%x,",mynew2[i]); } LCD_GotoPosition(3, 1); for(i=0; mynew3[i]!='\0'; i++) { LCD_ShowText(mynew3[i]); } } if(iAction==2) { Puts("Please select line number(1~4): "); Scanf("%d", &iLine); LCD_LineReverse(iLine); } if(iAction==3) { Puts("Please select line number(1~4): "); Scanf("%d", &iLine); LCD_LineRestore(iLine); } if(iAction==4) { LCD_BackLight_On(); } if(iAction==5) { LCD_BackLight_Off(); } if(iAction==6) { Puts("Cursor display on/off (1 or 0): "); Scanf("%d", &iDisplay); Puts("Character blink on/off (1 or 0): "); Scanf("%d", &iblink); LCD_CursorDisplay(iDisplay, iblink); } if(iAction==7) { LCD_ClrScrn(); } } }