Saturday, March 24, 2012

Controlling the Explorer 16 On-board Truly LCD

The Explorer 16 board comes equipped with a small LCD display controlled by a Novatek NT7603 LCD Controller. There are four signals used to control the NT7603 from the PIC32 (marked MPU in the diagram):
  • RS - Register select: Selects between the Instruction and Data registers.
  • E - Enable: Asserted high to start a read/write transaction.
  • RW - Read not Write: When asserted indicates a read, de-asserted indicates a write.
  • DATA - Data Bus: An 8-bit bus containing the data to be read/written to the indicated register.
For my purposes I connected these signals to General Purpose I/O (GPIO) on the PIC32 as follows:

  RS <-> RB15
  E  <-> RD4
  RW <-> RD5
  DATA <-> RE0 - RE7   


The databook describes the protocol for a read and write operation and describes a basic initialization flow. The code linked below shows my implementation of that flow, along with a puts_lcd(char* string) helper function which can be used to write a string to the display. 

The biggest challenge with implementing this code was figuring out what controlled the LCD screen on the Explorer 16 and finding a databook for that controller. I also found this controller a little difficult to work with as it seems to be very sensitive to the timings of the various commands. If you run into trouble use a Logic Analyzer to ensure that you are meeting the minimum delays after each command type before issuing the next command. Also ensure you are meeting the minimum timings for the write and read operations. These delays and timings are all listed in the databook.

Code:
References: