update: 14. 04. 2016
Pozice: Elektronika / AVR / Mega128 a ColorLCD /
Připojení LCD displeje LCD240x320(LGDP4531) k ATMega128 16Mhz a SD kartou.
Veškeré grafické objekty jsou uložené na SD kartě, z toho důvodu trvá déle načtení.
Toto je pouze zkušební demo, pro zjištění rychlosti komunikace MCU s displejem.
Po tomto testu jsem došel k názoru že není ideální zobrazovat obrázky s 24bitovou barevnou hloubkou.
Protože načítaní trvá příliš dlouho.
Fragment kodu zobrazovaní:
/* ,-----------------------------------------------------------------------------------------. | main |----------------------------------------------------------------------------------------- | Use Compiler [ WinAVR - 20070525 ] `-----------------------------------------------------------------------------------------*/ //---------------------------------------------------------------------------------------- #include "main.h" /* #include#include #include #include #include #include #include #include */ #include #include #include #include #include "demo-lcd.h" #include "drivers/delay.h" #include "drivers/LGDP4531/adc.h" //#include "drivers/timer1.h" #include "drivers/eeprom.h" #include "drivers/mmc/mmc.h" #include "drivers/mmc/file.h" #include "drivers/mmc/browser.h" //#include "drivers/mmc/config_file.h" #include "drivers/LGDP4531/lcdio.h" #include "drivers/LGDP4531/graphics.h" #include "drivers/LGDP4531/gfonts.h" #include "drivers/LGDP4531/touchpad.h" #include "drivers/LGDP4531/bmpsd.h" //extern PROGMEM unsigned int pic_data_server_bmp[]; //extern PROGMEM unsigned int pic_server_bmp[]; //--------------------------------------------------------------------------------------------------- int main(void) { // Inicializace LCD init_lcdio(); lcd_ClearDevice( BLACK ); lcd_print_startlist(); lcd_print_font( 1, ROTATE_0 ); lcd_print_color( 1, WHITE, 1, GRAY5, 0, 0 ); lcd_print_cursor( 5, 5 ); lcd_print( "S t a r t i n g s e q u e n c e...\n" ); lcd_print_color( 1, WHITE, 0, 0, 0, 0 ); lcd_print( "Init LCD..." ); TouchPadSize.tpxl=115, TouchPadSize.tpxr=915, TouchPadSize.tpyu=103, TouchPadSize.tpyd=876; // Klaibrace TouchPadu lcd_print( "OK\n" ); lcd_print( "Init MMC..." ); if ( !mmc_init() ) lcd_print( "OK\n" ); else lcd_print( "Error\n" ); lcd_print( "Init RS232..." ); lcd_print( "OK\n" ); lcd_print( "Start DEMO" ); lcd_demo_startmenu(); //--------------------------------- // START MENU while(1) { unsigned long tp; unsigned int tpx, tpy; if( lcd_TestTouchpad() > 10 ) { tp = lcd_GetTouchPoint(); tpx = lcd_CalcXpozTouch( tp ); tpy = lcd_CalcYpozTouch( tp ); if( lcd_IsTouch (46, 46+48, 161, 161+48, tp) ) { lcd_openFileBMP( 46, 161, 0, "BLANK.BMP"); while( lcd_TestTouchpad() > 10 ); demo_openFileTXT(); while( lcd_TestTouchpad() < 10 ); lcd_demo_startmenu(); } if( lcd_IsTouch (46, 46+48, 161+64, 161+64+48, tp) ) { lcd_openFileBMP( 46, 161+64, 0, "BLANK.BMP"); while( lcd_TestTouchpad() > 10 ); //fileOpen.Clustervar = 0; file_open( 0, "obrazky" ); browser_file_open( 5, 5, FILE_SHOW_DIRFILE); while( lcd_TestTouchpad() < 10 ); lcd_demo_startmenu(); } if( lcd_IsTouch (146, 146+48, 161+64, 161+64+48, tp) ) { lcd_openFileBMP( 146, 161+64, 0, "BLANK.BMP"); while( lcd_TestTouchpad() > 10 ); //fileOpen.Clustervar = 0; file_open( 0, "obrazky" ); browser_file_open2( 5, 5, FILE_SHOW_DIRFILE); while( lcd_TestTouchpad() < 10 ); lcd_demo_startmenu(); //break; } if( lcd_IsTouch (146, 146+48, 161, 161+48, tp) ) { lcd_openFileBMP( 146, 161, 0, "BLANK.BMP"); while( lcd_TestTouchpad() > 10 ); lcd_demo_paintscr(); lcd_demo_paint(); while( lcd_TestTouchpad() > 10 ); lcd_demo_startmenu(); //break; } }//end if Touch }//end while Start Cicle //-------------------------------------------------- return 0; }//end main //---------------------------------------------------------------------------------------------------
Soubory ke stažení
Nazev | typ | Delka | Vytvořeno |
---|---|---|---|
SDCard | zip | 399 KB | 13. 04. 2016 |
AVR_LCD240x320_LGDP4531 | zip | 1 MB | 13. 04. 2016 |