HD44780 LCD Help - Can't Display Characters
Hey guys quick LCD related question. I just recently bought a 2x16 hd44780 based LCD (datasheet: www.411techsystems.com/Ebay/Specs/SSC2F16DLNW-E.pdf and am using a basic stamp controller to operate it in 4 bit mode. Since this is my first real LCD project I have based 90% of my code off of the tutorial I found at www.weethet.nl/english/basicstamp2_lcdcontrol.php . I've got the LCD operational for the most part however my most recent problem is I cannot get the LCD to display any text.
Commands seem to be working just fine, however my LCD refuses to display any character I send at it. At first I figured that the RS line was still low when I was sending characters, but my multimeter proved otherwise. Strangely enough when using a cursor after sending a character the LCD will move the cursor one spot to the right as if I have sent a character, but no character appears. Here is the basic stamp code I am using:
As you can see, I attempt to write "A" to the LCD three times, and in the process the cursor moves the the fourth position as if the three next to it are filled with characters, however no A's ever show up
I'm assuming its just some stupid mistake in my code since the company supposedly tests every LCD before they are shipped.
Thanks in advance for the help, any suggestions are appreciated.
Commands seem to be working just fine, however my LCD refuses to display any character I send at it. At first I figured that the RS line was still low when I was sending characters, but my multimeter proved otherwise. Strangely enough when using a cursor after sending a character the LCD will move the cursor one spot to the right as if I have sent a character, but no character appears. Here is the basic stamp code I am using:
' {$STAMP BS2} ' -----[noparse][[/noparse] Constants ]------------------------------------------------------- ' Ports used RS CON 4 ' Register Select (1 = char) E CON 5 ' LCD Enable pin (1 = enabled) ' LCD control characters ' ClrLCD CON $01 ' clear the LCD CrsrHm CON $02 ' move cursor to home position CrsrLf CON $10 ' move cursor left CrsrRt CON $14 ' move cursor right DispLf CON $18 ' shift displayed chars left DispRt CON $1C ' shift displayed chars right DDRam CON $80 ' Display Data RAM control ' -----[noparse][[/noparse] Variables ]------------------------------------------------------- ' char VAR Byte ' character sent to LCD x VAR Byte ' loop counter ' -----[noparse][[/noparse] EEPROM Data ]----------------------------------------------------- ' Msg DATA "BASIC Stamp 2 LCD in action" ' preload message ' -----[noparse][[/noparse] Initialization ]-------------------------------------------------- ' Init: DIRL = %00111111 ' set pins 0-5 as outputs OUTS = $0000 ' clear the pins ' Initialize the LCD (Hitachi HD44780 controller) ' LCDinit: x=0 DEBUG "Starting..." PAUSE 500 ' Wait for LCD init ' ================================= ' STANDARD HITACHI 44780 4-BIT INIT ' ================================= char=%00000011 ' Set 8-bit mode (1) GOSUB LCDcmd PAUSE 10 char=%00000011 ' Set 8-bit mode (2) GOSUB LCDcmd PAUSE 10 char=%00000011 ' Set 8-bit mode (3) GOSUB LCDcmd PAUSE 10 char=%00000011 GOSUB LCDcmd ' Set 8-Bit mode (4) char=%00101000 ' Function Set 4-Bit mode GOSUB LCDcmd char=%0000100 ' Display Off GOSUB LCDcmd char=%0000001 ' Display Clear GOSUB LCDcmd char=%00000110 ' Entry Mode Set GOSUB LCDcmd char = clrLCD GOSUB LCDcmd char=%00001111 ' Display ON Cursor ON Blink ON GOSUB LCDcmd HIGH RS ' Set RS Line High for character mode char=%01000010 ' Write "A" to LCD GOSUB LCDwr char=%01000010 ' Write "A" to LCD GOSUB LCDwr char=%01000010 ' Write "A" to LCD GOSUB LCDwr STOP ' -----[noparse][[/noparse] Subroutines ]----------------------------------------------------- ' ' Send command to the LCD ' LCDcmd: LOW RS ' enter command mode ' ' Write ASCII char to LCD ' LCDwr: DEBUG DEC x OUTA = char.HIGHNIB ' output high nibble PULSOUT E, 1 ' strobe the Enable line OUTA = char.LOWNIB ' output low nibble PULSOUT E, 1 HIGH RS ' return to character mode RETURN
As you can see, I attempt to write "A" to the LCD three times, and in the process the cursor moves the the fourth position as if the three next to it are filled with characters, however no A's ever show up
I'm assuming its just some stupid mistake in my code since the company supposedly tests every LCD before they are shipped.
Thanks in advance for the help, any suggestions are appreciated.
Comments
Check the contrast circuit for problems, if there is one. If not, you may need to add one. Check the datasheet.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Programming can't be all that difficult, it's nothing but 1's and 0's
edit - just installed a contrast pot, now my contrast is adjustable but still no characters [noparse]:([/noparse]
On a side note, is there any possiblity the character ROM map was somehow erased? (yes I know what read only means, but is it a possibility?)
Post Edited (ndsbass) : 3/17/2008 1:35:13 AM GMT
Look at the small schematic on Page 2 of the datasheet. It shows that VR (a pot) needs to be placed between Vdd and Vss and the wiper lead connects to Vo (pin 3 on the LCD). Check that circuit out. That's where the problem probably lies.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Programming can't be all that difficult, it's nothing but 1's and 0's
· ' {$PBASIC 2.5}
Heres a picture of what I'm getting on my LCD. Excuse my cluttered breadboard
as you can see the three spaces before the cursor are where the characters should be, and I can move the cursor left and right by respectively removing and adding character commands, but the characters refuse to show up. I'm stumped on this one.
Also just to clarify there is a cursor but it is set to blink at the display command in my code. My camera caught it on the blink which is why the entire matrix is filled. In between blinks I get an underscore, which I'm assuming is the default cursor?
Post Edited (ndsbass) : 3/17/2008 2:44:23 AM GMT
Strange... When I insert it into my code the editor says symbol is already defined???
I'm just confused as to why my code isn't working. Since I can send commands in 4-bit mode it would seem the LCD has been initialized correctly? Why then shouldn't I be able to send characters in 4-bit? Anyways thanks for the help so far