Interfacing with a S6B0741

communicationglcdinterfacelcdprogramming

I am using a LPC4300 board to interface with a graphical LCD, a S6B0741. I have been trying to get it initialized, but I am not sure if I am sending the commands the correct way.

The code I have right now:

  GPIO_ClearValue (LCD_PINS.GPIOPortNum, (1<<LCD_PINS.GPIOBits[10]));
  GPIO_ClearValue (LCD_PINS.GPIOPortNum, (1<<LCD_PINS.GPIOBits[9]));
  GPIO_SetValue (LCD_PINS.GPIOPortNum, (1<<LCD_PINS.GPIOBits[12]));
  GPIO_SetValue (LCD_PINS.GPIOPortNum, (1<<LCD_PINS.GPIOBits[8]));

  SetBits (data); // sets the I/O data bus

  GPIO_ClearValue (LCD_PINS.GPIOPortNum, (1<<LCD_PINS.GPIOBits[8]));
  GPIO_ClearValue (LCD_PINS.GPIOPortNum, (1<<LCD_PINS.GPIOBits[12]));

All ports are defined as input ports.

I have tried following the initialization routine, as described in the datasheet, but it hasn't been working.

Is this correct?

EDIT
Should have had this in the original post, since the code as it is doesn't make sense really.

The pins are:

  • 0-7 data bus
  • 8 E
  • 9 RW
  • 10 RS
  • 11 RESETB
  • 12 CSB

The board is configured to use the 6800 Parallel Interface Mode.

EIDT2: Erroneously put it as 8080 mode rather than 6800.

Best Answer

Your code is not correct.

You should initialise the control lines to an inactive state at the start (CSB and E high), then to write data do the following:

Set your data bus lines to be outputs from the microprocessor
enable the display: /CSB low
set the RW line low
Write the command or data to the data bus lines
set the RS line as required
set the E line low
reset the E line to high
disable the display /CSB high

if you are making multiple writes, or you only have the one display on the bus you can leave the display enabled (/CSB low) while you change the data and then pulse the E line again.

You only need to set RW high if you need to read data from the display - don't forget to change the data bus lines on your MCU to be inputs before doing this.