This shows how to map a HD44780 based LCD panel (most LCD panels use the HD44780) to a file on phatIO. So you can save “Hello World” to the file and “Hello World” will be displayed on the LCD panel.
The phatIO driver is still fairly basic, uses the full 8-bit databus and just maps the HD44780 display RAM to file, but does provide ability to process newlines automatically. An updated driver will be posted later with support for 4-bit databus and using custom fonts.
Copy run.lio in the resources sidebar to your phatIO device (from the sidebar or browse the repository)
All you need is a phatIO, a HD44780 Display, connection cable, and optionally a potentiometer to adjust contrast.
HD44780 LCDs have 16 control pins, numbered 1–16. This example connects them to the phatIO as follows.
|LCD pin description
|VSS Power Supply (GND)
|VDD Power Supply (+5V)
|LCD Driver Power Supply
|GND or Potentiometer (see note)
|RS Register Select
|R/W Data Read & Write
|DB0 Databus 0
|DB1 Databus 1
|DB2 Databus 2
|DB3 Databus 3
|DB4 Databus 4
|DB5 Databus 5
|DB6 Databus 6
|DB7 Databus 7
|Back Light Anode
|Back Light Cathode
The data pins may be in a single or double row as shown below:
Copy run.lio to the
io directory on the phatIO device. This creates a driver
PHATIO/io/dev/lcd when text is written to this file, the screen will be cleared and the text written to it.
The LCD Driver chip contains an 80 character buffer that represents the characters on the display. The following image shows a 4 x 20 LCD when the text
"AAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCC DDDDDDDDDDDDDDDDDDDD" is entered:
To simplify use with smaller screens the number of columns per line can be added in the driver:
(defconst cols 8)
After this “ABC\nDEF” (with a new line between the letters C and D) would display:
More work is being done on this driver and updates will be published as they are developed, if you manage to use the driver with other LCDs - succesfully or not please comment on the forums
Any questions and suggests please discuss in the forum.