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...

 

WD-C2401P LCD Panel Driver

The Serial Wombat can greatly simplify connecting supported LCD displays to a computer, Basic Stamp, 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 24 character HD66717 based WD-C2401P LCD Display currently being sold by All Electronics for the super-low price of $1.85.

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 5 of the LCD to ground.
  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. The LCD reset is LCD pin 3. Controlling the Reset pin with the Wombat will result in more reliable operation.
  7. Pick 8 Wombat pins to connect them to the 8 data pins (7 through 14) of the LCD.
  8. Send the Wombat Two 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 24 characters, the rest of the spaces on the display will be blank. (See message format Below)

 

Message Format:

There are three messages used to display a string on this LCD Display. The first two tell 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 # 0xF1 RS Pin Reset Pin D0 Pin D1 Pin D2 Pin
Meaning: Configure Pin First message The Wombat Pin connected to the 'E' line of the LCD (LCD pin 6) Channel Mode Number for WD-C2401P LCD Panel The Wombat Pin connected to the RS line of the LCD (LCD pin 4) The Wombat Pin connected to the Reset line of the LCD (LCD pin 3) ( Enter zero for none) The Wombat Pin connected to the D0 (least significant) line of the LCD (LCD pin 7) The Wombat Pin connected to the D1 line of the LCD (LCD pin 8) The Wombat Pin connected to the D2 line of the LCD (LCD pin 9)
This message is echoed back by the Wombat.

 

Data Sent to the Wombat: 201 Pin # 0xF1 D3 Pin D4 Pin D5 Pin D6 Pin D7 Pin
Meaning: Configure Pin Second message The Wombat Pin connected to the 'E' line of the LCD (LCD pin 6) Channel Mode Number for WD-C2401P LCD Panel The Wombat Pin connected to the D3 line of the LCD (LCD pin 10) 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 (most significant) 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).

Data Sent to the Wombat: 202 Pin # 0xF1 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 WD-C2401P LCD 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 24 characters.
This message is echoed back by the Wombat.

The 203 message is used to download characters into the LCD's character generation ram. This LCD supports up to four custom characters, which are stored in 32 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 # 0xF1 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 WD-C2401P LCD Panel 0: Top of 1st char
4: Bottom of 1st char
8: Top of 2nd char
12: Bottom of 2nd char
16: Top of 3rd char
20: Bottom of 3rd char
24: Top of 4th char
28: Bottom of 4th Char:
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 put the LCD driver software into bar-graph mode. In this mode a 96 level bar graph will display the value of any public data provided by a Wombat channel. This mode requires approximately 20ms to initialize, during which other processing is suspended.

Data Sent to the Wombat: 204 Pin # 0xF1 Pin to Graph 0x55 0x55 0x55 0x55
Meaning: Configure Pin Fifth message The Wombat Pin connected to the 'E' line of the LCD (LCD pin 6) Channel Mode Number for WD-C2401P LCD Panel The pin number whose public data is to be displayed as a bargraph. Unused.
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 "Hello world, my new LCD display is working great!". This string is 49 characters long. We'll add 8 spaces to the end of the message to space out the wraparound. The LCD should delay 500 frames (500ms by default) between scrolling. The string should be placed starting at offset 0x0050. The 'E' LCD pin is attached to Wombat pin 22. The 'RS' LCD pin is attached to Wombat pin 21. The 'Reset' LCD pin is attached to Wombat pin 23. LCD Data lines 0 to 3 are attached to Wombat pins 27 to 30. Data lines 4 to 7 are attached to Wombat pins 33 to 37.

Messages to send:

200 22 0xf1 21 23 27 28 29  ; Initialize Wombat pin 22 to LCD, (attached to 'E')
                            ; Wombat pin 21 to LCD 'RS'
                            ; Wombat pin 23 to LCD 'Reset'
                            ; Wombat pins 27-29 to LCD D0 - D2
201 22 0xf1 30 33 34 35 36 
                            ; Wombat pin 30 to LCD D3,
                            ; Wombat pins  33-36 to LCD D4-D7
202 22 0xf1 0x00  0x50  57 1  0xF4
                            ; Read string from 0x0050
                            ; String is 57 characters long
                            ; delay 0x01F4 (500) frames between scrolls
146 0 0x50 4 'H' 'e' 'l' 'l'   ;Put the 4 bytes "Hell" into user address 0x0050
                               ;And update internal pointer
147 'o' ' ' 'w' 'o' 'r' 'l' 'd' ; Put string "o world" at internal pointer,
                                ; update internal pointer
147 ',' ' ' 'm' 'y' ' ' 'n' 'e' 
147 'w' ' ' 'L' 'C' 'D' ' ' 'd' 
147 'i' 's' 'p' 'l' 'a' 'y' ' ' 
147 'i' 's' ' ' 'w' 'o' 'r' 'k'  
147 'i' 'n' 'g' ' ' 'g' 'r' 'e' 
147 'a' 't' '!' ' ' ' ' ' ' ' ' 
148 4 ' ' ' ' ' ' ' ' 0x55 0x55  ; Put 4 bytes "    " at the internal pointer,
                                 ; Update pointer.

Example 2: Display a Happy Face and 'Have a Nice Day!'

Assume that the LCD is connected as in Example 1. The 200 and 201 messages will therefore be the same as above. The string in this example will be placed at user memory offset 0x20. Including the two custom characters for the happy face, this string will be 18 characters long.

The happy face bitmaps must be created. The bytes for each line are as follows:

0x03
0x0C
0x12
0x10
0x12
0x11
0x0C
0x03
  0x18
0x06
0x09
0x01
0x09
0x11
0x06
0x18

The left half of the smiley face will be placed in character 0. The right half will be placed in character 1.

 

Messages to send:

200 22 0xf1 21 23 27 28 29  ; Initialize Wombat pin 22 to LCD, (attached to 'E')
                            ; Wombat pin 21 to LCD 'RS'
                            ; Wombat pin 23 to LCD 'Reset'
                            ; Wombat pins 27-29 to LCD D0 - D2
201 22 0xf1 30 33 34 35 36 
                            ; Wombat pin 30 to LCD D3,
                            ; Wombat pins  33-36 to LCD D4-D7
202 22 0xf1 0x00  0x20  18 0x55  0x55
                            ; Read string from 0x0020
                            ; String is 18 characters long
                            ; delay is unnecessary, so fill bytes with 0x55 
146 0 0x20 4 0 1 'H' 'a'   ;Put the 4 bytes  0x00, 0x01, and "Ha" into address 0x0020
                               ;And update internal pointer
147 'v' 'e' ' ' 'a' ' ' 'n' 'i' ; Put string "ve a ni" at internal pointer,
                                ; update internal pointer
147 'c' 'e' ' ' 'd' 'a' 'y' '!' 

203 22 0xf1 0 0x03 0x0C 0x12 0x10  ;Load the top half of the left face into char 0
203 22 0xf1 4 0x12 0x11 0x0C 0x03  ;Load the bottom half of the left face into char 0
203 22 0xf1 8 0x18 0x06 0x09 0x01  ;Load the top half of the left face into char 1
203 22 0xf1 12 0x09 0x11 0x06 0x18  ;Load the top half of the left face into char 1

 

Example 3: Display a Bar Graph based on Pin 2

 

Assume that the LCD is connected as in Example 1, and that Pin 2 is measuring some analog input signal. The 200 and 201 messages will be the same as above. The bargraph displayed on the LCD will be the public data value of pin 2 (between 0x0000 and 0xFFFF).

This can be great for debugging purposes!

Messages to send:

200 22 0xf1 21 23 27 28 29  ; Initialize Wombat pin 22 to LCD, (attached to 'E')
                            ; Wombat pin 21 to LCD 'RS'
                            ; Wombat pin 23 to LCD 'Reset'
                            ; Wombat pins 27-29 to LCD D0 - D2
201 22 0xf1 30 33 34 35 36 
                            ; Wombat pin 30 to LCD D3,
                            ; Wombat pins  33-36 to LCD D4-D7
204 22 0xf1 2 0x55 0x55 0x55 0x55  ; Display Pin 2 as bargraph

 

 

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