Microchip PIC Serial LCD driver

Running on breadboard
LCD driver

As a gift for putting you through revamping my site, here are the particulars for a microchip pic serial LCD driver that I personally use in projects and used to sell commercially.

The SLD01a serial LCD driver design is a for a Microchip PIC 16F628a, but it should be simple to port over to any PIC with a USART. It converts serial data in either RS-232c or TTL formats to display on any Hitachi HD44780-compatible LCD. Applications include industrial/PLC control read-outs, microprocessor projects, computer mods, and anything else that uses serial data. It doesn’t have a lot of bells and whistles (but it DOES have a bell DRIVER) as some other drivers do. It’s designed to be a simple, light-weight terminal-style display.

To paraphrase the documentation sheet:

The SLD01a serial LCD driver will convert raw serial data into a 4-bit parallel format applicable to LCD displays which use a Hitachi HD44780-compatible character display chipset. A 64 byte receive buffer is used to assist in data loss prevention.

The SLD01a requires a 5vdc powersupply. Additional support circuitry is necessary to convert RS232C data signals to TTL if the SLD01a is intended for this purpose. A MAX232 or similar is typically all that is required, as shown in the sample schematic.

Serial data must be in format: 8-bit, no parity, 1 stop bit, and at the rate of 9600 bps. Any other settings will require editing the provided source.

When the non-text linefeed and carriage return characters are received the SLD01a will cause the LCD display cursor to move to the first character placement on the next line of the display. After the last character of the last line is reached the SLD01a will clear the display and begin again at the first character of the first line.

When the non-printable delete character is encountered, the SLD01a will delete the last displayed character.

When the non-printable ASCII bell character 7 (0x07) is encountered the aux pin (6) will energize briefly. This is the same as the ‘b’ escape sequence.

Some proprietary escape sequences allow for some additional features. Escape sequences begin with the ASCII escape character 27 (0x1b) The table in sheet 3 below lists the escape sequences recognized by the SLD01a and the functions that they perform.

The LCD can be configured for specific numbers of columns and lines with two additional escape sequences. The desired number of columns is set by first sending the escape character, then a lower-case ‘x’, followed by two digits to specify the number of columns allowed before the SLD01a forces a line-break. The LCD line count is specifed in a similar manner – ecsape + lower-case ‘y’ + two digits. For example, to set the SLD01a to format in 16 x 2 mode you would send “\x16\y02”, (with the backslash representing the escape character) LCD configurations are saved in the SLD01a EEPROM which is persistant even when powered down. This makes it only necessary to configure the SLD01a the first time it is matched to any given LCD.

Sample schematic
Sheet 1: Sample schematic using an interface chip


Sample wiring diagram
Sheet 2: Sample wiring diagram using an interface chip

Documentation
Sheet 3: Documentation


The code below was compiled using the CC5X compiler. Using another compiler will likely require compatibility tweaks. Do to several requests I am also making available for download the HEX file.