ATMega128 TFT LCD(COM26T2844) 테스트
ATMega128을 이용하여 [LCD_EXP EVM] 보드를 테스트 했다.
자료 정리 차원에서 정리해 본다.
ATMega128 TFT LCD(COM26T2844) Pinmap
ATMega128 TFT LCD(COM26T2844) Driver Code
TFT LCD 기본 테스트 예제코드
테스트 동영상
ATMega128 7.3728Mhz에서 TFT LCD테스트
ATMega128을 이용하여 [LCD_EXP EVM] 보드를 테스트 했다.
자료 정리 차원에서 정리해 본다.
ATMega128 TFT LCD(COM26T2844) Pinmap
ATMega128 TFT LCD(COM26T2844) Driver Code
//-----------------------------------------------------------------------------
// TFT LCD(COM26T2844) Driver
#define TFT_DRV_COM44 1
#define LCD_EN_BIT BIT5
#define LCD_EN_PORT PORTB
#define LCD_ENABLE() Cbi(LCD_EN_PORT, LCD_EN_BIT)
#define LCD_DISABLE() Sbi(LCD_EN_PORT, LCD_EN_BIT)
#define LCD_RST_BIT BIT4
#define LCD_RST_PORT PORTD
#define LCD_RST_ON() Sbi(LCD_RST_PORT, LCD_RST_BIT)
#define LCD_RST_OFF() Cbi(LCD_RST_PORT, LCD_RST_BIT)
#define LCD_RS_BIT BIT7
#define LCD_RS_PORT PORTE
#define LCD_RS_OFF() Cbi(LCD_RS_PORT, LCD_RS_BIT)
#define LCD_RS_ON() Sbi(LCD_RS_PORT, LCD_RS_BIT)
#define LCD_WR_BIT BIT3
#define LCD_WR_PORT PORTG
#define LCD_WR_OFF() Cbi(LCD_WR_PORT, LCD_WR_BIT)
#define LCD_WR_ON() Sbi(LCD_WR_PORT, LCD_WR_BIT)
#define LCD_RD_BIT //BIT7
#define LCD_RD_PORT //PORTA
#define LCD_RD_OFF() //Cbi(LCD_RD_PORT, LCD_RD_BIT)
#define LCD_RD_ON() //Sbi(LCD_RD_PORT, LCD_RD_BIT)
#define LCD_BL_BIT BIT4
#define LCD_BL_PORT PORTB
#define LCD_BL_OFF() Cbi(LCD_BL_PORT, LCD_BL_BIT)
#define LCD_BL_ON() Sbi(LCD_BL_PORT, LCD_BL_BIT)
#define TFTGpioInit() DDRA = 0xFF;\
DDRC = 0xFF;\
Sbi(DDRB, BIT4|BIT5);\
Sbi(DDRD, BIT4);\
Sbi(DDRE, BIT7);\
Sbi(DDRG, BIT3);
#define DATA_OUT(Data) PORTA = (Data&0xFF); PORTC = ((Data>>8)&0xFF)
// TFT LCD(COM26T2844) Driver
#define TFT_DRV_COM44 1
#define LCD_EN_BIT BIT5
#define LCD_EN_PORT PORTB
#define LCD_ENABLE() Cbi(LCD_EN_PORT, LCD_EN_BIT)
#define LCD_DISABLE() Sbi(LCD_EN_PORT, LCD_EN_BIT)
#define LCD_RST_BIT BIT4
#define LCD_RST_PORT PORTD
#define LCD_RST_ON() Sbi(LCD_RST_PORT, LCD_RST_BIT)
#define LCD_RST_OFF() Cbi(LCD_RST_PORT, LCD_RST_BIT)
#define LCD_RS_BIT BIT7
#define LCD_RS_PORT PORTE
#define LCD_RS_OFF() Cbi(LCD_RS_PORT, LCD_RS_BIT)
#define LCD_RS_ON() Sbi(LCD_RS_PORT, LCD_RS_BIT)
#define LCD_WR_BIT BIT3
#define LCD_WR_PORT PORTG
#define LCD_WR_OFF() Cbi(LCD_WR_PORT, LCD_WR_BIT)
#define LCD_WR_ON() Sbi(LCD_WR_PORT, LCD_WR_BIT)
#define LCD_RD_BIT //BIT7
#define LCD_RD_PORT //PORTA
#define LCD_RD_OFF() //Cbi(LCD_RD_PORT, LCD_RD_BIT)
#define LCD_RD_ON() //Sbi(LCD_RD_PORT, LCD_RD_BIT)
#define LCD_BL_BIT BIT4
#define LCD_BL_PORT PORTB
#define LCD_BL_OFF() Cbi(LCD_BL_PORT, LCD_BL_BIT)
#define LCD_BL_ON() Sbi(LCD_BL_PORT, LCD_BL_BIT)
#define TFTGpioInit() DDRA = 0xFF;\
DDRC = 0xFF;\
Sbi(DDRB, BIT4|BIT5);\
Sbi(DDRD, BIT4);\
Sbi(DDRE, BIT7);\
Sbi(DDRG, BIT3);
#define DATA_OUT(Data) PORTA = (Data&0xFF); PORTC = ((Data>>8)&0xFF)
TFT LCD 기본 테스트 예제코드
#include "system.h"
#include "serial.h"
#include "tft_lcd.h"
//-----------------------------------------------------------------------------
int main(void)
{
SystemInit();
int delay_time = 1;
Led1Init();
Led1On();
//Serial Init
U0_Init(BAUD_115200);
printf("myAVR Mega128 Test Program1\r\n");
TftLcd_Init(); //Initial LCD
while(1)
{
Disp_Full_Color(Red);
Delay(delay_time);
Disp_Full_Color(Green);
Delay(delay_time);
Disp_Full_Color(Blue);
Delay(delay_time);
Ver_8Gray_Disp() ;
Delay(delay_time);
Hor_8Gray_Disp() ;
Delay(delay_time);
Ver_8Color_Disp() ;
Delay(delay_time);
Hor_8Color_Disp() ;
Delay(delay_time);
}
}
//-----------------------------------------------------------------------------
#include "serial.h"
#include "tft_lcd.h"
//-----------------------------------------------------------------------------
int main(void)
{
SystemInit();
int delay_time = 1;
Led1Init();
Led1On();
//Serial Init
U0_Init(BAUD_115200);
printf("myAVR Mega128 Test Program1\r\n");
TftLcd_Init(); //Initial LCD
while(1)
{
Disp_Full_Color(Red);
Delay(delay_time);
Disp_Full_Color(Green);
Delay(delay_time);
Disp_Full_Color(Blue);
Delay(delay_time);
Ver_8Gray_Disp() ;
Delay(delay_time);
Hor_8Gray_Disp() ;
Delay(delay_time);
Ver_8Color_Disp() ;
Delay(delay_time);
Hor_8Color_Disp() ;
Delay(delay_time);
}
}
//-----------------------------------------------------------------------------
테스트 동영상
ATMega128 7.3728Mhz에서 TFT LCD테스트
반응형