|Liquid crystal displays are very useful for displaying both text and numbers. They display information sent from a PIC.
How does it operate?
These notes refer to the Serial LCD/clock module available from Rapid (order code 13-1266) and Revolution (AXE033). This is one of the simplest and lowest cost LCDs available.
The LCD comes in kit form with a pre-populated PCB. Construction only involves connecting the LCD to the PCB.
Sending data from the PIC to the LCD module involves sending what is called ‘serial data’. This means that the bits that represent a number or a letter are sent one bit at a time. It is not necessary to understand a lot about serial communication to use an LCD, but details can be found on the web.
The details of how to send data from the PIC to the LCD depend on the PIC programming software. The software used must include a command to send serial data.
For example, in the case of PIC Logicator the command SerOut is used.
|To send a character to the LCD we place it in the Data field. Several characters can be sent in one command by separating them by commas. The above command would send ‘254’ and then ‘1’ (this would clear the display).
To write text to the LCD the message is typed into the Data field and the ASCII (which stands for American Standard Code for Information Interchange) box is ticked.
The example shown would print the word ‘Hello’.
|To print the value of a variable on the LCD the name of the variable is enclosed in square brackets [ ] and the ASCII box ticked. So this command would print the value of the variable ‘A’ – which could be the reading for temperature, time, light level, or any analogue value.|
The LCD module has a number of special control commands (full details are in supplier’s data sheet). Common control commands are:
- 254,1 Clear Display (must be followed by a delay of at least 30ms)
- 254,128 Move to line 1, position 1
- Display for a weather station
- A toy for a child that aids reading or counting
- A multi-function clock
- A metronome that shows beats per minute and the musical name of the tempo
There are a number of connection pads at the side of the LCD PCB. The only ones that are needed for simple applications are those labelled ‘V+’, ‘IN’ and ‘0V’.
‘V+’ and ‘0V’ are connected across the power supply. 5V to 6V is suitable. For a 4.5V power supply, a wire link needs to be added (see data sheet for details).
The ‘IN’ terminal is connected to the serial data signal from the PIC.
Full details of all the connection are given in the data sheet.
Connections to the LCD
Connect a power supply to the main connection header. The LCD should display the message ‘00/00/00 00:00’ when the two CLK contacts are shorted and once the contrast has been adjusted (via the variable resistor marked ‘contrast’).
Once the ‘00/00/00 00:00’ test message is displayed, write a short program to send data from the PIC e.g.
- Delay for 0.5s to allow the display to stabilize
- Clear the display
- Delay for 30ms
- Send a message e.g. ‘Hello’ to the display
If the LCD does not display a message check the power, the contrast and the 14 connector pins.
- 7-segment displays can display a few digits. They are less expensive but can only display a very limited range of characters
- Dot matrix displays can display numbers and characters, but they are more complicated to use
- Electroluminescent displays can be used to illuminate a fixed message, but the message cannot be changed
- The LCD described can be extended by including an optional clock for applications where accurate and/or long timing is needed
Return to list of datasheets