Projects Home Schematics Datasheets Links    
   
Description

Adding a character LCD module to any embedded design is not a daunting task. Today there are many LCD manufacturers such as Optrex, Hantronix, Microtips, etc, that offer a variety of character LCD modules with a parallel interface based on the old Hitachi HD44780 or its Samsung cousin KS0066 controllers.

The HD44780 parallel interface became sort of a de facto standard for communicating a microprocessor or microcontroller to a dot matrix character display, this interface is also being used today for some vacuum fluorescent displays (VFD).

The interface consists on a 4 or 8 bit bidirectional data and address bus, and three control signals, Enable (E), Register Select (RS to gain access to the controller registers or via DMA to the character RAM buffer) and Read/Write (RW to select the direction of the operation and bidirectional bus).

This project shows an example about how to add a character LCD module to the LJCV Electronics eIP-10 Board running the Microchip TCP/IP Stack.






eIP-10 + 4x20 LCD
[Click Image to Enlarge]
Design considerations

To save some I/O pins we will use a 4-bit parallel interface for the LCD. Also in many cases there is no need to read back any data from the LCD since we will be using delays instead of checking for a BUSY state (the LCD driver routines for the TCP/IP Stack must be non blocking to permit cooperative multitasking) then we can tie R/W to gnd saving an extra I/O pin.

For this project I used a Hantronix HDM40216 4x20 display module. The picture above shows the eIP-10 board and the LCD mounted in a prototype board. Ignore the extra ICs on the top left, they are part of other project to decode the SPI interface for a logic analyzer.

Then we will use the following I/O pins to drive the LCD:

RB0 - LCD DB4
RB1 - LCD DB5
RB2 - LCD DB6
RB3 - LCD DB7
RB4 - LCD RS
RB5 - LCD E

A detailed schematic is available in the links section below.


Getting the board up and running

The latest modified version of the Microchip TCP/IP Stack v3.75 includes a different set of LCD drivers than the original version. The new driver is more versatile and easy to configure and includes the option to write to a local character memory buffer (as used in the TCP/IP Stack code) or directly to the LCD memory buffer.

The hardware configuration is defined in the eip10_lcd.h include file which for the LCD configuration includes the following macros:

//***************************************************************
// LCD Module features and configuration
//
#define USE_LCD
#define USE_CM_LCD // Include Character Mode LCD Driver
#define LCD_USE_BUFFER // Enable local RAM LCD Buffer
//#define LCD_USE_CGCHARS // Enable Custom Characters support
#define LCD_4BIT_IFACE
#define LCD_ROWS 4
#define LCD_COLS 20

typedef struct
{
unsigned char data : 4; // Lower nibble
unsigned char : 4;
} LCD_DATA;

#define LCD_DATA_IO (((volatile LCD_DATA*)&LATB)->data)
#define LCD_RS_IO (LATBbits.LATB4)
#define LCD_E_IO (LATBbits.LATB5)

Make sure that this configuration reflects your circuit and LCD geometry (rows & columns), and remember to properly set the initial values for the direction and initial state for the I/O port in the GPIO Ports assignment section.

This new version adds the EIP10 macro definition that combined with the device selection for the Microcontroller generates the appropriate code for this particular project.

The software distribution includes the MPLAB IDE project file EIP10.mcp, load this project into MPLAB IDE, select the correct processor (by default the project has selected the PIC18F2620) and verify that the settings on the config.h are consistent with your project and that for the EIP10 you are including the eip10_lcd.h header file.

For additional details check the README.TXT file included in the software distribution.

For a detailed explanation about how to build Microchip's TCP/IP stack
for this or similar projects Click Here.


Schematics & Firmware source Code

eIP10 + parallel LCD Schematics  
Building the Microchip TCP/IP Stack for this project  


Datasheets for relevant parts used in this project

LJCV Electronics eIP-10 Board Product Page  
Hantronix HDM40126 Character LCD Module  


Useful Links

TCP/IP Stack Source code and useful software tools

Microchip's TCP/IP Stack v3.02  
Microchip's TCP/IP Stack v3.60  
Microchip's TCP/IP Stack v3.75  
Microchip's TCP/IP Stack v4.02  
Microchip's TCP/IP Latest Version  
Microchip's MPLAB Integrated Development Environment  
Microchip's MPLAB C18 Compiler  
Wireshark (formerly Ethereal) Network Protocol Analyzer  
CoffeCup HTML Editor 2007  


Additional Resources

Brush Electronics Ethernet Boot Loader  
Microchip TCP/IP Stack Application Note (AN833)  
Microchip Users Forum - TCP/IP-Ethernet  




   
    ©2006-2009, Jorge Amodio, All rights reserved

Last Update: Jan 28, 2008