RGPIO – LCD Screens

Common Character LCD Screens can be controlled with between 6 and 11 GPIO pins. RGPIO L-Mode contains simple support for a 6-pin or 7-pin solution. The 6 or 7 pins are D4,D5,D6,D7,EN,RS with an optional RW (for most uses RW can be hard-wired to GND).

Initialize RGPIO with the ports:

L<RS>,<RW>,<EN>,<D4>,<D5>,<D6>,<D7>D

For the PiBoard, the initialization is (RW is hardwired to GND, and we use 0 for that pin:

L17,0,11,22,23,24,25C

The initialization will reset the the screen and clear it.
Some screens need additional initialization which need to be sent to the screen separately.
To write characters to the LCD:

LDHello world

To send special codes, use \Cxx or \Xxx where xx is a hexadecimal pair. \C for a command (RS=1) and \X for a character (RS=0). For example, to write to the screen’s top-left, prefix with \C80. (the beginning of row 2 is often \CA0 on a 2-line screen).
Special positioning commands include \C01 (clear screen); \C02 (go to top left)
When sending \ using a command shell or programming language that uses \ as an escape character, you will need to double it:

./p LD\\C80

These screens usually have a built-in font with most of the characters you need, and with the ability to add your own characters at code positions 00-07 or 00-0F.
To add an elipsis at character position 00 (6 blank rows, one row of alternate bits,1 blank row):

LD\C40\x00\x00\x00\x00\x00\x00\x15\x00\xC80

To print a short line of elipsis characters

LD\x00\x00\x00\x00\xC80

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *