|Serial Text LCD module|
This project connects a Text LCD display
to a microcontroller or PC via a single serial transmission line (plus power).
One of the challenges of integrating a text LCD display is the number of pins to connect. A display module typically has 16 lines, with 11 for data and control. That's a lot of lines for a microprocessor to handle. One way to handle it is to get an I/O expander (I2C or SPI)
, another way is to use a serial protocol such as a UART. The advantage of have a UART compatible text LCD display module is that it can be controlled with just a single TX line. The downside is using up one of (or your only) microcontroller's UART transmission line, unless you can use software UARTs.
|Prototype with serial connections|
My requirements included performing a very simple firmware implementation. I didn't want to spend a lot of effort creating the module. And I wanted to learn the communications with the LCD module
, so limiting to just a text interface was not desired. I ended up implementing a 6-bit raw protocol, and writing a .NET program to talk to the LCD using 4-bit mode. I already had some firmware for my 485 monitor that I quickly adapted for use with the LCD. Bytes are received serially on the RX line, then output to the PORTB, of which 6-bits are wired to the LCD. After echoing the raw hex back on the TX line (for diagnostics, not necessary for operation), the data byte is strobed with bit 5 cleared to finalize communication with the LCD. I ended up expanding on the .NET program to have a form where what is typed on the screen is efficiently updated to the LCD screen.
I want to interface with 3.3V microcontrollers, and I want the cost to be low, so I used an available PIC18F26K22
I had received as a sample from Microchip, with the circuit using 5V from USB stepped down to 3.3V with a voltage regulator
for the CPU. The LCD runs at 5V, accepting 3V logic from the CPU. The latest version of the circuit has an added jumper to select whether the PIC runs at 3.3V or 5V, which in turn determines the I/O voltage levels of the module. The five port socket includes 5V, 3.3V (output), Ground, TX (output), and RX. Minimally only 5V, Ground, and TX need to be connected. This PIC is currently configured to run at its top speed of 64MHz! (This may be overkill for just driving an LCD.) The LED in the circuit is a heartbeat to show that the PIC is running.
|.NET program and hex diagnostics |
I plan to immediately use this module with other PIC, Arduino, and Netduino
projects. Writing the .NET program allowed me to more easily learn the LCD protocol than debugging the firmware. I may expand the firmware to move more of the LCD protocol into the PIC18 firmware, or at least have that option. Other possibilities are to implement I2C and/or SPI interfaces.