Serial Wombat
a general-purpose digital interface device for hobbyists, engineers and students

 


Home
Overview
Protocol
Documentation
Channel Modes
Direct Control
Controlled Pin
Raw A/D
A/D Averaging
A/D 1st Order Filtering
Matrix Keypad
Servo Control
Analog Direct
Analog Follow
Rotary Encoder
Debouncing
Counter
Hysteresis
Morse Code
Pulse
Unipolar Stepper
LCD Driver 1
LCD Driver 2
HW Pulse Meas.
2D Lookup
SPI Master
HD44780 Generic
Remote Control
DataLogger
Min-Max
Public Data
Timed IO
Getting Started
Connectivity
Pin Mode SDK Beta
Sample Projects
Downloads
Contact Us
Purchase
Forum

Did you know...

 

Hitachi HD44780 24 x 2 LCD Panel Driver

The Serial Wombat can greatly simplify connecting supported LCD displays to a computer, Basic Stamp, PicAxe or other device with a Serial Interface. The host simply has to tell the Wombat which lcd pins are attached to which Wombat Pins, and where in the Wombat's user data area to find the message to display.

This driver is for the 24x 2 line character HD44780 based WD-C2401P LCD Display currently being sold by All Electronics.

For more technical details on this part, see the parts page.

Using this LCD with the Wombat is easy! Just follow these steps:

  1. Wire Pin 1 of the LCD to ground.
  2. Wire Pin 2 of the LCD to +5 volts.
  3. Wire Pin 3 of the LCD to ground (This worked for me. On some LCDs you may need to use a potentiometer between 0 and 5 volts to get good contrast. Some of the reviews on All Electronics have suggested 0.5 volts).
  4. Pick a Wombat pin and connect it to the 'E' pin on the LCD. This is Pin 6 on the LCD. This will be the Wombat pin used to run the LCD interface software.
  5. Pick a Wombat pin and connect it to the 'RS' pin on the LCD. This is pin 4 on the LCD.
  6. Pick a Wombat pin and connect it to the 'Reset' pin on the LCD, or tie 'Reset' high instead of attaching it to the Wombat. Controlling the Reset pin with the Wombat will result in more reliable operation.
  7. Pick 4 Wombat pins to connect them to the 4 most-significant data pins (7 through 14) of the LCD.
  8. Send the Wombat a Messages explaining which Wombat pins are attached to which LCD pins. (See Below)
  9. Send the Wombat a series of Messages to load the string to be displayed into the Wombat's user data area (See the Protocol page for information on how to do this).
  10. Send the Wombat a message which explains where in the Wombat's user data area to find the string, how long the string is, and how long to wait between scrolling characters if the string is longer than the display. If the string is less than 48 characters, the rest of the spaces on the display will be blank. (See message format Below). It is also possible to tell the Wombat to treat this display as two 24 character displays.

 

Message Format:

There are two messages needed to display a string on this LCD Display. The first one tells the Wombat which LCD lines are attached to which Wombat pins. Hook them up any way you like!

Data Sent to the Wombat: 200 Pin # 0xF2 RS Pin D4 Pin D5 Pin D6 Pin D7 Pin
Meaning: Configure Pin First message The Wombat Pin connected to the 'E' line of the LCD (LCD pin 6) Channel Mode Number for 24x2 HD44780 Panel The Wombat Pin connected to the RS line of the LCD (LCD pin 4) The Wombat Pin connected to the D4 line of the LCD (LCD pin 11) The Wombat Pin connected to the D5 line of the LCD (LCD pin 12) The Wombat Pin connected to the D6 line of the LCD (LCD pin 13) The Wombat Pin connected to the D7 line of the LCD (LCD pin 14)
This message is echoed back by the Wombat.

 

The next message is used to tell the Wombat where in memory to look for the string to be displayed, how long the string is, and how long to wait between scrolling characters (if the string is wider than the screen). Note that message #201 is not used. This is to keep the protocol for this LCD as similar to other LCDs as possible.

Data Sent to the Wombat: 202 Pin # 0xF2 String Address (High byte) String Address (low byte) String Length
(1 to 255 characters)
Delay Frames (High Byte) Delay Frames (Low Byte)
Meaning: Configure Pin Third message The Wombat Pin connected to the 'E' line of the LCD (LCD pin 6) Channel Mode Number for 24x2 HD44780 Panel The Address in user memory where the string can be found. The length of the string. Strings do not include a termination character. The number of frames to wait between scrolling characters, if the String length is greater than 48 characters.
This message is echoed back by the Wombat.

The 203 message is used to download custom characters into the LCD's character generation ram. This LCD supports up to eight custom characters, which are stored in 64 bytes of the LCD's memory. Each character is 5 pixels wide, by 8 pixels long. In order to program a custom character, send two 203 messages to the Wombat containing the 8 bytes making up the bitmap. In each message, provide an offset into the character-generation RAM, and four bytes of the bitmap. This message should be sent after the 202 message. This message may take up to 20ms to complete, and processing of other functions will be suspended during this time.

Data Sent to the Wombat: 203 Pin # 0xF2 Offset into Character generation RAM Bitmap data line (uppermost) Bitmap data line Bitmap data line Bitmap Data Line
Meaning: Configure Pin Fourth message The Wombat Pin connected to the 'E' line of the LCD (LCD pin 6) Channel Mode Number for 24x2 HD44780 Panel 0: Top of 1st char
4: Bottom of 1st char
8: Top of 2nd char
12: Bottom of 2nd char
...and so on up to 8 chars
Bitmap bytes use the least-significant 5 bits to describe the 5 pixels of the character line. The rightmost pixel is the least-significant bit. '1' bits are black pixels.
This message is echoed back by the Wombat.

 

The 204 message is used to treat the display as two separate 24 character lines. This allows one or two lines to scroll different messages. This can be useful if you want a fixed line of text on the first line, and a scrolling message on the second line. This message should be issued following message 202. The delay period given in message 202 is used for both strings. If both strings are longer than 24 characters, then they will move alternately at one half of the delay time.

Data Sent to the Wombat: 204 Pin # 0xF2 2nd String Address (high byte) 2nd String Address (low byte) length of 2nd string UNUSED UNUSED
Meaning: Configure Pin Fifth message The Wombat Pin connected to the 'E' line of the LCD (LCD pin 6) Channel Mode Number for 24x2 HD44780 Panel The Address in the User Memory Area where the second string is to be displayed. Length of the 2nd string to be displayed.    
This message is echoed back by the Wombat.

Loading your string

Three Messages are available for moving byte-sized data into the Wombat's User Data area. The first message writes up to 4 bytes, and sets an internal pointer to the next byte after the written bytes. The second message writes 7 bytes starting at the pointer set by the previous message, and moves the pointer to the next byte to be written. A third message writes a variable number of bytes (up to 6) starting at the internal pointer address, and sets the pointer to the next byte to be written.

See the procotol page for the formal definition of these messages.

Example 1: Display a string

Display the string "--www.SerialWombat.com--LCD 107 HD44780 24x2/EL-". This string is 48 characters long. Since this string will fit entirely on the screen, we'll just set the delay to zero. The string should be placed starting at offset 0x0050. The 'E' LCD pin is attached to Wombat pin 35. The 'RS' LCD pin is attached to Wombat pin 36. LCD Data lines 4 to 7 are attached to Wombat pins 29, 30, 33 and 34.

Messages to send:

200 35 0xf2 36 34 33 30 29 
202 35 0xf2 0  0x50  48 0  0
146 0 0x50 4 '-' '-' 'w' 'w'
147 'w' '.' 'S' 'e' 'r' 'i' 'a'
147 'l' 'W' 'o' 'm' 'b' 'a' 't'
147 '.' 'c' 'o' 'm' '-' '-' 'L'
147 'C' 'D' ' ' '1' '0' '7' ' '
147 'H' 'D' '4' '4' '7' '8' '0'
147 ' ' '2' '4' 'x' '2' '/' 'E'
148 2 'L' ' ' 0x55 0x55 0x55 0x55

Example 2: Display Big and Small Hearts, and a message:

Assume that the LCD is connected as in Example 1. The 200 message will therefore be the same as above. The string in this example will be placed at user memory offset 0x20. The string will be 48 characters long. We'll create the big heart out of 6 custom characters, and the small heart out of one custom character. Once custom characters are created, the are accessed just like any ohter character.

The heart bitmaps must be created. The bytes for each line of the big heart are as follows:

For example, the upper left segment of the heart would be made up of data 0x00, 0x03, 0x07, 0x0F,0x0F, 0x1F,0x1F,0x1F.

0x00
0x03
0x07
0x0F
0x0F
0x1F
0x1F
0x1F
0x00
0x00
0x11
0x1B
0xFF
0xFF
0xFF
0xFF
0x18
0x1C
0x1E
0x1E
0x1F
0x1F
0x1F
     
0x0F
0x07
0x03
0x01
0x00
0x00
0x00
0x00
0x1F
0x1F
0x1F
0x1F
0x1F
0x0E
0x04
0x00
0x1E
0x1C
0x18
0x10
0x00
0x00
0x00
0x00

 

Messages to send:

200 35 0xf2 36 34 33 30 29 
202 35 0xf2 0 0 48 0 0

203 35 0xf2 0 0x00 0x03 0x07 0x0F ;Heart upper left (Character 0)
203 35 0xf2 4 0x0F 0x1F 0x1F 0x1F

203 35 0xf2 8 0x00 0x00 0x11 0x1B ;Heart upper middle (Character
1)
203 35 0xf2 12 0xFF 0xFF 0xFF 0xFF

203 35 0xf2 16 0x00 0x18 0x1C 0x1E ; Heart upper right (Character
2)
203 35 0xf2 20 0x1E 0x1F 0x1F 0x1F

203 35 0xf2 24 0x0F 0x07 0x03 0x01 ;Heart lower left (Character
3)
203 35 0xf2 28 0x00 0x00 0x00 0x00

203 35 0xf2 32 0xFF 0xFF 0xFF 0xFF ;Heart lower middle (Character
4)
203 35 0xf2 36 0xFF 0x0E 0x04 0x00

203 35 0xf2 40 0x1E 0x1C 0x18 0x10 ;Heart Lower Right (Character
5)
203 35 0xf2 44 0x00 0x00 0x00 0x00

203 35 0xf2 48 0x00 0x0A 0x1F 0x1F ;Small Heart (Character 6)
203 35 0xf2 52 0x1F 0x0E 0x04 0x00

146 0 0 4 0x00 0x01 0x02 ' ' 
147 0x06 0x06 ' ' 'J' 'o' 'n' ' ' 
147 'l' 'o' 'v' 'e' 's' ' ' 0x06
147 0x06 ' ' ' ' 0x00 0x01 0x02 0x03 
147 0x04 0x05 ' ' 0x06 0x06 0x06 ' ' 
147 'S' 'h' 'e' 'l' 'l' 'e' 'y' 
147 ' ' 0x06 0x06 0x06 ' ' ' ' 0x03 
148 2 0x04 0x05 0x55 0x55 0x55 0x55




Example 3: One line of fixed text, one scrolling:

Comming soon...

 

 

Copyright Wombat Interface Products, 2005-2008. All Rights Reserved.