Hello All,
I am undergraduate student. I want to interface LCD display EADOGM 16*2 with STM32 controller.
I am using 8 bit interface. The connection is as below RS-D7 RW-D8 E-D9 C0-C7 are connected to data lines of LCD. I could find some display driver and i have modified according to my requirement.
When i run this application, I could not see anything Displayed. Can anyone pls suggest where am i wrong
ea-dogm-ex1.c #include "ea-dogm-ex1.h" #include #define EADOGM162 1
// some special symbol chrs defined #define EADMSYM_DEG 0b11011111 // degree symbol #define EADMSYM_DARWL 0b11111011 // double > #define EADMSYM_LT 0b00111100 // less than < #define EADMSYM_GT 0b00111110 // greater than > #define EADMSYM_OHM 0b00011110 // ohm symbol
// some command defines #define EADMCMD_CONTRAST 0b0111000 // contrast command (0b0111xxxx)
// we noticed some issues with GLOBAL on pic24 devices #ifndef GLOBAL #define GLOBAL INTR_GLOBAL #endif
// 2x16 #ifdef EADOGM162 #define EADOGM_ROWS 2 #if EADOGMVDD == 5 #define EADOGM_INIT_BIAS_SET 0x1C #define EADOGM_INIT_POWER_CONTROL 0x52 #define EADOGM_INIT_FOLLOWER_CONTROL 0x69 #define EADOGM_INIT_CONTRAST_SET 0x74 #else #define EADOGM_INIT_BIAS_SET 0x14 #define EADOGM_INIT_POWER_CONTROL 0x55 #define EADOGM_INIT_FOLLOWER_CONTROL 0x6D #define EADOGM_INIT_CONTRAST_SET 0x78 #endif
#define EADOGM_INIT_FS1 0x39 #define EADOGM_INIT_FS2 0x38 #define EADOGM_INIT_CLEAR_DISPLAY 0x01 #define EADOGM_INIT_ENTRY_MODE 0x06 #define EADOGM_COLSPAN 40 // suggested that this be 40 on model 162 #endif
#define EADOGM_CMD_CLR 1 #define EADOGM_CMD_CURSOR_ON 0b00001111 #define EADOGM_CMD_CURSOR_OFF 0b00001100 #define EADOGM_CMD_DISPLAY_ON 0xC #define EADOGM_CMD_DISPLAY_OFF 0b00001000 #define EADOGM_CMD_DDRAM_ADDR 0x80 #define EADOGM_CMD_CGRAM_ADDR 0x40 #define EADOGM_CMD_SELECT_R0 0b00011000 #define EADOGM_CMD_SELECT_R1 0b00010000 #define EADOGM_CMD_SET_TABLE2 0b00101010
void eaDogM_ini8Bit(void) { DisplayOutputDrive(DISPLAY_E); DisplayOutputDrive(DISPLAY_RW); DisplayOutputDrive(DISPLAY_RS); DisplayOutputLow(DISPLAY_E); DisplayOutputLow(DISPLAY_RS); DisplayOutputLow(DISPLAY_RW); }
void eaDogM_WriteChr(char value) { DisplayOutputHigh(DISPLAY_RS); DisplayOutputLow(DISPLAY_RW); DisplayOutputLow(DISPLAY_E); DisplayOutputHigh(DISPLAY_E); Delay(1); DisplayOutputDrive(value); DisplayOutputLow(DISPLAY_E); Delay(1); }
void eaDogM_WriteCommand(uint8_t cmd) { DisplayOutputLow(DISPLAY_RS); DisplayOutputLow(DISPLAY_RW); DisplayOutputLow(DISPLAY_E); // #ifndef EADOGM_NOCSB //// DisplayOutputLow(EADOGM_PIN_CSB); // #endif DisplayOutputHigh(DISPLAY_E); Delay(1); // EADOGM_8BIT_PORT(cmd); DisplayOutputLow(DISPLAY_E); Delay(1); // #ifndef EADOGM_NOCSB // DisplayOutputLow(EADOGM_PIN_CSB); // #endif // Delay(1); }
//// spi mode //void eaDogM_WriteChr(char value) //{ // DisplayOutputHigh(EADOGM_PIN_RS); // DisplayOutputLow(EADOGM_PIN_CSB); // eaDogM_outSPI(value); // DisplayOutputHigh(EADOGM_PIN_CSB); // Delay(1); //} // //void eaDogM_WriteCommand(uint8_t cmd) //{ // DisplayOutputLow(DISPLAY_RS); // DisplayOutputLow(EADOGM_PIN_CSB); // eaDogM_outSPI(cmd); // DisplayOutputHigh(EADOGM_PIN_CSB); // Delay(1); //}
void eaDogM_Initialize(void) {
eaDogM_ini8Bit(); //#else // DisplayOutputDrive(EADOGM_PIN_CSB); // DisplayOutputDrive(DISPLAY_RS); // DisplayOutputHigh(EADOGM_PIN_CSB); // DisplayOutputHigh(DISPLAY_RS);
Delay(200);
eaDogM_WriteCommand(EADOGM_INIT_FS1); eaDogM_WriteCommand(EADOGM_INIT_BIAS_SET); eaDogM_WriteCommand(EADOGM_INIT_POWER_CONTROL); eaDogM_WriteCommand(EADOGM_INIT_FOLLOWER_CONTROL); eaDogM_WriteCommand(EADOGM_INIT_CONTRAST_SET); eaDogM_WriteCommand(EADOGM_INIT_FS2); eaDogM_WriteCommand(EADOGM_INIT_CLEAR_DISPLAY); eaDogM_WriteCommand(EADOGM_INIT_ENTRY_MODE); }
// v2.01 moved functions to macros #define eaDogM_DoubleHeightOff() eaDogM_WriteCommand(0b00101000) #define eaDogM_Cls() eaDogM_WriteCommand(EADOGM_CMD_CLR) #define eaDogM_CursorOn() eaDogM_WriteCommand(EADOGM_CMD_CURSOR_ON) #define eaDogM_CursorOff() eaDogM_WriteCommand(EADOGM_CMD_CURSOR_OFF)
#define eaDogM_DisplayOff() eaDogM_WriteCommand(EADOGM_CMD_DISPLAY_OFF)
void eaDogM_DisplayOn() { eaDogM_WriteCommand(EADOGM_CMD_DISPLAY_ON); }
void eaDogM_SetPos(uint8_t r, uint8_t c) { uint8_t cmdPos; cmdPos = EADOGM_CMD_DDRAM_ADDR + (r * EADOGM_COLSPAN) + c; eaDogM_WriteCommand(cmdPos); }
void eaDogM_ClearRow(uint8_t r) { uint8_t i; eaDogM_SetPos(r,0); for(i=0; i