标题: c语言写的液晶显示 [打印本页] 作者: winnie 时间: 2009-4-15 10:32 标题: c语言写的液晶显示 Code for a varitron 128 x 64 LCD display which use a T6363 LCD controller (by Jan van Gelder).
/************************************************************************************************** File name : lcd_examples* Discription : examples how to make use of the LCD functions in lcd873.c ******************************************************************************************************/#include "Lcd873.c"void main(void);//////////////////////////////////////////////////////////////////////////////////////////////////// TEST ROUTINE'S to test LCD code ////////////////////////////////////////////////////////////////////////////////////////////////////void main(void){ char i; char j; const char *text = "Graphic LCD 128 x 64 T6963C "; const char *text3 = "Signal meter"; const char *text4 = "Spektrum Monitor"; const char *text5 = "TEXT BOX"; LCDPortIOInit(PortAConfig,PortBConfig,PortCConfig); LCDIniSet(); LCDClearTextRAM(); LCDClearGraphicRAM(); AGAIN: // example how to write a predefined string to display LCDSetAdresPointer(LINE1_PAGE1T); for(i = 0; text[i] != 0 ;i++) { LCDputchar(text[i]); } delay_s(2); // let text blinks on display LCDBlinkingText(1600,20,1); // example how to clear text page1 LCDClearTextPage(1); // write string "Signal meter" to display LCDSetAdresPointer(LINE3_PAGE1T); for(i = 0; text3[i] != 0 ;i++) { LCDputchar(text3[i]); } // example of a signalmeter with diferent value's for( i = 0 ; i < 250; i ++) { LCDDrawSignalMeter(LINE3_PAGE1G + 4 ,1,i); i ++; } for( i = 250 ; i > 3; i --) { LCDDrawSignalMeter(LINE2_PAGE1G + 4,1,i); i --; } // example of how to draw a spektrum display with vertical bars // clear all text ram LCDClearTextRAM(); LCDSetAdresPointer(LINE2_PAGE1G); LCDDrawHorLine(SOLID,16); LCDSetAdresPointer(LINE6_PAGE1G); LCDDrawHorLine(DOTS1,16); LCDSetAdresPointer(LINE10_PAGE1G); LCDDrawHorLine(DASH1,16); LCDSetAdresPointer(LINE14_PAGE1G); LCDDrawHorLine(DOTS2,16); LCDSetAdresPointer(LINE18_PAGE1G); LCDDrawHorLine(DASH,16); delay_s(2); // set adres pointer where to write the string Spektrum Monitor LCDSetAdresPointer(LINE8_PAGE1T); for(i = 0; text4[i] != 0 ;i++) { LCDputchar(text4[i]); } // example which draws bars with differend values j = 2; for( i = 0; i < 128 ;i++) { LCDDrawVerticalBar(LINE1_PAGE1G,i,j); j = j + 2; } delay_s(2); LCDClearGraphicRAM(); LCDDrawVerticalBar(LINE1_PAGE1G,64,32); LCDDrawVerticalBar(LINE1_PAGE1G,65,48); LCDDrawVerticalBar(LINE1_PAGE1G,66,32); delay_s(1); LCDDrawVerticalBar(LINE1_PAGE1G,100,64); LCDDrawVerticalBar(LINE1_PAGE1G,101,128); LCDDrawVerticalBar(LINE1_PAGE1G,102,64); delay_s(1); LCDDrawVerticalBar(LINE1_PAGE1G,10,100); LCDDrawVerticalBar(LINE1_PAGE1G,11,200); LCDDrawVerticalBar(LINE1_PAGE1G,12,100); delay_s(1); LCDDrawVerticalBar(LINE1_PAGE1G,64,200); LCDDrawVerticalBar(LINE1_PAGE1G,65,250); LCDDrawVerticalBar(LINE1_PAGE1G,66,200); delay_s(1); LCDDrawVerticalBar(LINE1_PAGE1G,64,32); LCDDrawVerticalBar(LINE1_PAGE1G,65,48); LCDDrawVerticalBar(LINE1_PAGE1G,66,32); delay_s(2); LCDBlinkingText(800,20,1); delay_s(4); LCDClearGraphicRAM(); LCDClearTextRAM(); LCDDrawTextBox(LINE14_PAGE1G + 1,10,12); LCDSetAdresPointer(LINE3_PAGE1T+2); for(i = 0; text5[i] != 0 ;i++) { LCDputchar(text5[i]); } delay_s(2); LCDBlinkingText(900,10,1); LCDClearGraphicRAM(); LCDClearTextRAM(); LCDDrawSquare(LINE32_PAGE1G + 2,8,32); delay_ms(500); LCDDrawSquare(LINE4_PAGE1G + 5,4,16); delay_ms(500); LCDDrawSquare(LINE8_PAGE1G + 8,8,32); delay_s(1); LCDClearGraphicRAM(); LCDClearTextRAM(); goto AGAIN;}