Interfacing with Colour LCDs

There is a very popular 320×240 262K colour LCD available very cheaply on ebay and aliexpress.com.

Although the LCD Controller chip (SSD1289) can be interface via 8bit, 16bit parallel or serial SPI, this particular popular LCD screen is ‘hardcoded’ to work only with 16bit parallel. The LCD screen model is the HY-32D.

Don’t be fooled that getting this screen will allow you to access it via SPI! The 16bit parallel interface requires 16 data bus lines, and 4 control lines (Read Strobe, Write Strobe, Chip Select, Data/Command). That’s a total of 20 I/O pins required from the microcontroller.

We can however save on I/O if we have a little think.

  • If we don’t want to read back from the LCD, then we can ignore the ReadStrobe. (Saves 1)
  • If we only have one device on this 16bit bus, ChipSelect can be permanently selected. (Saves 1)
  • Use a pair of 74HC164 Serial -> Parallel Shift Registers. This converts a Serial CLK/DAT pair to be 16 parallel WRITE ONLY bus. (Saves 14)
  • Connecting the Serial DAT line to the Data/Command line (Saves 1)

Now the total I/O cost is now: CLK, DAT, WriteStrobe – 3 I/O.

The HY-32D also has a Touch Screen. The pins required are simple 4 wire SPI, MISO, MOSI, SCK, CS plus optional IRQ.

Since most projects already use an SPI bus, we can reuse the bus for the Touch Panel. This effectively means the TP can be interfaced with an extra 2 I/O – CS and IRQ (assuming you want Interrupt Requests).

Since the paried 74HC164s also use a CLK/DAT setup, we can also connect these to the SPI bus onto the SCK and MOSI lines respectively.

Total Cost to Connect the HY-32D? 3 I/O + SPI! 3 I/O! is amazing!

I’ve recently added a ‘Motivation’ section to the end of my future posts. Take a look for some background knowledge!

Motivation

What new knowledge, materials, products, devices, processes or services does this aim to produce?

Colour LCDs and Touch Panels are now becoming expected in everyday electronics.

We need to develop products to cater to the new generation of users by including these aspects into our design.

What eligible activities were undertaken to meet this objective?

1.  An investigation into available products – there are several alternatives.

Price, availability and suitability had to be evaluated. Black and White LCDs tend to be cheaper, but do not have touch screens.

  • Black and White LCDs – no Touch Screen
    • HD44780 Alphanumeric LCD
    • KS0108 Black and White Graphical LCD
    • ST7920 Black and White Graphical LCD
  • Colour LCDs with Touch Screen
    • HY-32D (SSD1289 with ADS7932 TP Controller)

2.  Each option also had to have it’s interface methods evaluated.

Not all modules supported all interface methods, and some options only supported ONE method of interface.

Interface Methods included:

  • 8 bit parallel
  • 16 bit parallel (8080/6800 method)
  • 3 wire SPI
  • 4 wire SPI

3.  Once a suitable module had been chosen, the interface had to be merged into the overall product design.

  • Was there an existing SPI bus that can be used?
  • What modes were required (Read/Write, Read Only, Write Only)
  • Does the existing design have enough I/O to accommodate the interface method?
  • How can I/O be saved? By using a additional logic chips, certain Interface methods can be reduced by 14 I/O

What is the scientific or technological uncertainty this project seek to resolve?

With a limited microcontroller can we still interface with a relatively complex device? The microcontrollers chosen have limited capability to help reduce costs. Even if the microcontroller can interface with the module, is the performance enough?

Even after drawing the schematic, the software / firmware written onto the micro might be too slow or the interface method could be limited the maximum speed. This would result in display performance being undesirable or too slow/responsive for the end user.

What appreciable element of novelty does this project contain?

Currently, colour touch screens and the domain of powerful smartphones, PCs, tablets etc. By implementing this solution on a low cost microcontroller, we can develop low cost device which fulfill a niche requirement or need.

Advertisements