본문 바로가기

[ST_MICRO]/STM32F103-SM

[NET-EXP] STM32를 이용한 TFT LCD제어

[NET-EXP] STM32를 이용한 TFT LCD제어




NET-EXP에서 SM모듈과 LCD-CONV 모듈 이용시 TFT LCD 핀맵




//-----------------------------------------------------------------------------
//TFT LCD
#define TFT_DRV_HD66791                 0
#define TFT_DRV_COM44                   1

#define LCD_LAT_BIT      BIT8
#define LCD_LAT_PORT     PORTA
#define LCD_LAT_ON()     Sbi(LCD_LAT_PORT, LCD_LAT_BIT)
#define LCD_LAT_OFF()     Cbi(LCD_LAT_PORT, LCD_LAT_BIT)
#define LCD_DATA_LATCH()    LCD_LAT_ON();LCD_LAT_OFF();

#define LCD_EN_BIT      BIT14
#define LCD_EN_PORT      PORTA
#define LCD_ENABLE()     Cbi(LCD_EN_PORT, LCD_EN_BIT)
#define LCD_DISABLE()     Sbi(LCD_EN_PORT, LCD_EN_BIT)

#define LCD_RST_BIT      //BIT8
#define LCD_RST_PORT     //PORTB
#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      BIT8
#define LCD_RS_PORT      PORTB
#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      BIT13
#define LCD_WR_PORT      PORTA
#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      BIT9
#define LCD_RD_PORT      PORTB
#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      //BIT6
#define LCD_BL_PORT      //PORTA
#define LCD_BL_OFF()     //Cbi(LCD_BL_PORT, LCD_BL_BIT)
#define LCD_BL_ON()      //Sbi(LCD_BL_PORT, LCD_BL_BIT)

#define _LCD_DAT_OUT(Data)    PORTB = (PORTB&0xFF00) | (Data>>8);\
                                     LCD_DATA_LATCH();\
                                     PORTB = (PORTB&0xFF00) | (Data&0xFF);

#define TFTGpioInit()     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);\
          GPIO_InitStructure.GPIO_Pin = 0xFFFF;\
          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\
          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\
          GPIO_Init(GPIOA, &GPIO_InitStructure);\
          RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);\
          GPIO_InitStructure.GPIO_Pin = 0xFFFF;\
          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\
          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\
          GPIO_Init(GPIOB, &GPIO_InitStructure);\
          RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);\
          GPIO_InitStructure.GPIO_Pin = BIT12|BIT13|BIT15;\
          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\
          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\
          GPIO_Init(GPIOC, &GPIO_InitStructure);
//-----------------------------------------------------------------------------


반응형