|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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:
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!
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).
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.
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.
Loading your stringThree 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 stringDisplay the string 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:
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.