Connecting a LCD to TINI
TINI LCD Online Messages

I have a TINI online here with a servlet for sending messages to a 40x2 character LCD, or you can type your message here to send it ot the TINI...

Send A Message to the TINI LCD




Connecting an LCD to TINI

The revision A socket board, available from Dallas Semiconductor, already has provision for connecting a LCD module to the TINI with the addition of a few extra components. Most modules use a clone of the Hitachi HD44780 controller that Dallas have supplied an LCDPort class to drive, I used a 8x2 backlit module from RS, which works well.
On this page are instructions of the modification necessary to the socket board to connect the LCD, along with some Java for testing the LCD, and a digital clock class because it was the first thing that came into my head...

Parts List

All the ICs are the SOIC package type, so you'll probably neeed some pretty fine solder. I got all my components from RS Components in the UK, so i've listed the RS part numbers in brackets, except for the bits that I found lying around...
  • Semiconductors
    • U2 - CD74AC02M (184-0534)
    • U3 - CD74AC32M (833-298)
    • U4 - MC74AC139D (258-0031)
    • U10 - 74ACT138SC (324-3648)
  • Resistors
    • R4 - 10R0 SMT chip resisitor (347-9651)
    • R6 - 10ohm 0.25watt thru hole
    • R5 - 2K potentiometer
  • Capacitors
    • C5 - 47uF SMT Case C (406-9924)
  • LCD Module
    • 8x2 STN Transflective LCD Module (214-3480)




Construction

The ICs are all soldered on the underside of the board, I found it pretty useful to use a tiny bit of blu-tack to hold them in place before soldering them in. R6 is only necessary if your LCD is backlit, the +ve connection being made on pin 30 of J17.

Any spare bits of IDC that are lying areound are good for connecting up the LCD module to J17 as the connections are all along one edge.


The schematic on Dallas' site gives details of the connections on J17, but for convenience they're listed below:

  • PIN 2 GND
  • PIN 4 +5V
  • PIN 6 Contrast
  • PIN 8 RS Register Select
  • PIN 10 R/W Read/Write
  • PIN 12 E Enable
  • PIN 14->28 - D0->D7
  • PIN 30 Backlight +ve

Testing

The RS data sheet details the commands for controlling the LCD, and the LCDPort.sendControl() method can be used to send them to the module. The address, which sets the position in the the character memory to write data, can similarly be set using the LCDPort.setAddress() method. To send text to the display, give the character to LCDPort.sendData() as a parameter.
The character memory is set out into two rows of forty characters, with the display showing a two row, eight character window onto the contents of the character memory.


For quick reference, I've put the hex values for the common commands here - my mental areithmetic is particularly useless. Note that this information is for the LCD listed above, others may be different.

  • Initialisation
    • 0x38 - two line display
    • 0x30 - one line display
  • Cursor Type
    • 0x0C - No Cursor
    • 0x0E - Underscore Cursor
    • 0x0F - Blinking Cursor
  • Cursor/Display Shifting
    • 0x01 - Clear display; returns the cursor to the home position (address 0x00)
    • 0x02 - Return the cursor to the home position (address 0x00); returns shifted display to original position
    • 0x18 - Shift the display to the left
    • 0x1C - Shift the display to the right
    • 0x10 - Shift the cursor to the left
    • 0x14 - Shift the cursor to the right
  • Entry Mode
    • 0x04 - Decrement Cursor, No Display Shift
    • 0x05 - Decrement Cursor, Shift Display
    • 0x06 - Increment Cursor, No Display Shift
    • 0x07 - Increment Cursor, Shift Display

To test the construction, I wrote a couple of simple classes. LCDTest simply sends commands or data to the LCD from the command line and is useful for figuring out what's going on. The other, LCDClock, turns TINI into a digital clock, daft, but cool. You may now drink your weak lemon drink...