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