Overview
The EADOGS-102-6 is a simple monocolor graphics LCD screen that can be written to using a SPI interface. This display supports SPI clock frequencies of up to 33MHz. This LCD is a good choice for student projects because the programming interface is very straight forward and has through hole pins as compared to the delicate ribbon cable connectors found on many other low cost LCD screens.
Initialization
The EADOGS-102-6 does not have a MISO connection, but it does have a CD pin which places the display into command mode. When CD is equal to 0, data packets transmitted to the display are used to configure the behavior of the device. The device data sheet gives the proper sequence of commands to initialize the display for basic use.
//***************************************************************************** //***************************************************************************** bool lcd_initialize(void) { GPIOA_Type *gpioResetPtr; GPIOA_Type *gpioCmdPtr; uint8_t tx_data; uint8_t rx_data; if( lcdConfig.spi_base == 0 || lcdConfig.reset_pin_base == 0 || lcdConfig.cmd_pin_base == 0) { return false; } gpioResetPtr = (GPIOA_Type *)lcdConfig.reset_pin_base; gpioCmdPtr = (GPIOA_Type *)lcdConfig.cmd_pin_base; //Take the LCD out of reset gpioResetPtr->DATA |= lcdConfig.reset_pin_num; //Enter Command Mode gpioCmdPtr->DATA &= ~lcdConfig.cmd_pin_num; //Set Scroll Line tx_data = 0x40; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set SEG Directions tx_data = 0xA1; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set COM direction tx_data = 0xC0; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set All Pixel on tx_data = 0xA4; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set Inverse Display tx_data = 0xA6; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //et LCD Bias Ratio tx_data = 0xA2; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set Power Control tx_data = 0x2F; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set VLCD Resistor Ratio tx_data = 0x27; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set Electronic Volume tx_data = 0x81; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); tx_data = 0x10; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set Adv Program Control tx_data = 0xFA; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); tx_data = 0x90; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Set Display Enable tx_data = 0xAF; spiTx(lcdConfig.spi_base,&tx_data, 1, &rx_data); //Exit Command Mode gpioCmdPtr->DATA |= lcdConfig.cmd_pin_num; return true; }
Pixel Layout
We can display images and text by turning on specific pixels within the display. The 64 vertical columns of the EADOGS-102-6 is organized into 8 pages. Each of these 8 pages has 102 columns.
Using the UC1701 programming commands defined on page 5 of the data sheet, we can turn on/off specific pixels in the display.
If we wanted to turn on all the pixels in Page 0, column 0, we could use the following steps:
- Enter command mode by setting the CD pin to 0
- Send 0xB0 (Set Page Address: 1011 xxxx where xxxx is the page address)
- Send 0x00 (Set least significant byte of column address: 0000 yyyy where yyyy is the least significant 4 bits of the column number)
- Send 0x10 (Set most significant byte of column address: 0001 zzzz where zzzz is the most significant 4 bits of the column number)
- Exit command mode by setting the CD pin to 1
- Send 0xFF (Write one byte of data to the active page & column combination).
If we wanted to turn on all the pixels in Page 2, column 100, we could use the following steps:
- Enter command mode by setting the CD pin to 0
- Send 0xB2 (Set Page Address: 1101 xxxx where xxxx is the page address)
- Send 0x04 (Set least significant byte of column address: 0000 yyyy where yyyy is the least significant 4 bits of the column number)
- Send 0x16 (Set most significant byte of column address: 0001 zzzz where zzzz is the most significant 4 bits of the column number)
- Exit command mode by setting the CD pin to 1
- Send 0xFF (Write one byte of data to the active page & column combination).