Okay so I don't know what i'm doing wrong, but its not working, so I need the help of the forum.
I'm working on a firmware chip for serial and I2C for an LCD. Unfortunately I'm not even having any luck turning the LCD on. Its powering up and just producing a series of black boxes on the bottom row.
The code is hippy's code for parrallel interfacing to an LCD, modified slightly to take account of new reserved words and so on:
I'm working without, unfortunately, the aid of a scope or anything similar, just my simple multimeter.
For the most part it seems to be working as expected, and if i measure the outputs on pinC at the end of the program, the match what i expect to see, except for DB4-7 which are all at +5 volts (when at the end i'd expect DB4 at +5 and DB5-7 at +0V)
I've checked my wiring and am as sure as i can be that it is correct. I've got the contrast set so that the black isn't hard on, allowing me to be reasonably sure its not just a contrast issue.
The LCD came from: http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=270751918039&ssPageName=STRK:MEWNX:IT
and its datasheet can be found here:
http://www.bonafide.com.hk/catalog/MC1602-18.pdf (yeah i know crap datasheet)
The controller is a KS0066U which i'm informed is compatible with the HD44780, however for reference datasheet for the KS0066U is here: javascriptpenreq('http://www.datasheetcatalog.org/datasheet/SamsungElectronic/mXuuzvr.pdf')
I'm using a 20X2 on veroboard, and yes i have checked for shorts between the tracks.
Any suggestions that anyone could make would be much appreciated.
I'm working on a firmware chip for serial and I2C for an LCD. Unfortunately I'm not even having any luck turning the LCD on. Its powering up and just producing a series of black boxes on the bottom row.
The code is hippy's code for parrallel interfacing to an LCD, modified slightly to take account of new reserved words and so on:
Code:
SYMBOL RS = C.2 ; 0 = Command 1 = Data
SYMBOL E = C.3 ; 0 = Idle 1 = Active
SYMBOL DB4 = C.4 ; LCD Data Line 4
SYMBOL DB5 = C.5 ; LCD Data Line 5
SYMBOL DB6 = C.6 ; LCD Data Line 6
SYMBOL DB7 = C.7 ; LCD Data Line 7
SYMBOL RSCMDmask = %00000000 ; Select Command register
SYMBOL RSDATmask = %00000100 ; Select Data register
SYMBOL getEEP = b11
SYMBOL byteOut = b12
SYMBOL rsbit = b13
PowerOnReset:
GOSUB InitialiseLcd
DisplayTopLine:
EEPROM 6,("Hello")
FOR getEEP = 6 TO 10
READ getEEP,byteOut
GOSUB SendDataByte
NEXT
MoveCursorToStartOfSecondLine:
byteOut = $C0
GOSUB SendCmdByte
DisplayBottomLine:
EEPROM 11,("World!")
FOR getEEP = 11 TO 16
READ getEEP,byteOut
GOSUB SendDataByte
NEXT
Debug
END
InitialiseLcd:
FOR getEEP = 0 TO 5
READ getEEP,byteOut
GOSUB SendInitCmdByte
NEXT
' Nibble commands - To initialise 4-bit mode
EEPROM 0,( $33 ) ; %0011---- %0011---- 8-bit / 8-bit
EEPROM 1,( $32 ) ; %0011---- %0010---- 8-bit / 4-bit
' Byte commands - To configure the LCD
EEPROM 2,( $28 ) ; %00101000 %001LNF00 Display Format
EEPROM 3,( $0C ) ; %00001100 %00001DCB Display On
EEPROM 4,( $06 ) ; %00000110 %000001IS Cursor Move
; L : 0 = 4-bit Mode 1 = 8-bit Mode
; N : 0 = 1 Line 1 = 2 Lines
; F : 0 = 5x7 Pixels 1 = N/A
; D : 0 = Display Off 1 = Display On
; C : 0 = Cursor Off 1 = Cursor On
; B : 0 = Cursor Steady 1 = Cursor Flash
; I : 0 = Dec Cursor 1 = Inc Cursor
; S : 0 = Cursor Move 1 = Display Shift
EEPROM 5,( $01 ) ; Clear Screen
RETURN
SendInitCmdByte:
PAUSE 15 ; Delay 15mS
SendCmdByte:
rsbit = RSCMDmask ; Send to Command register
SendDataByte:
pinsC = byteOut & %11110000 | rsbit ; Put MSB out first
PULSOUT E,1 ; Give a 10uS pulse on E
pinsC = byteOut * %00010000 | rsbit ; Put LSB out second
PULSOUT E,1 ; Give a 10uS pulse on E
debug
rsbit = RSDATmask ; Send to Data register next
RETURN
For the most part it seems to be working as expected, and if i measure the outputs on pinC at the end of the program, the match what i expect to see, except for DB4-7 which are all at +5 volts (when at the end i'd expect DB4 at +5 and DB5-7 at +0V)
I've checked my wiring and am as sure as i can be that it is correct. I've got the contrast set so that the black isn't hard on, allowing me to be reasonably sure its not just a contrast issue.
The LCD came from: http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=270751918039&ssPageName=STRK:MEWNX:IT
and its datasheet can be found here:
http://www.bonafide.com.hk/catalog/MC1602-18.pdf (yeah i know crap datasheet)
The controller is a KS0066U which i'm informed is compatible with the HD44780, however for reference datasheet for the KS0066U is here: javascriptpenreq('http://www.datasheetcatalog.org/datasheet/SamsungElectronic/mXuuzvr.pdf')
I'm using a 20X2 on veroboard, and yes i have checked for shorts between the tracks.
Any suggestions that anyone could make would be much appreciated.