help with the 74hc164 LCD driver [solved]
It's me again My last shit register troubles were, it turns out, really caused by a faulty breadboard. As the ultimate goal was to make a 3-wire LCD interface using a shift register I have now moved on to 74hc164 (8-bit shift-register) and made a simple circuit on a stripboard.
Filling the register by the use of the shiftout command on my picaxe 20x2 seems to be working correctly (checked by the LEDs connected to the register outputs). The problem arises when I try to connect the circuit to the LCD (that is working quite happily with the standard 6-wire interface) - I don't get any output.
My guess is that either my initialisation sequence is wrong or one of the pins idles in the wrong logic state (or possibly timing?). The circuit is based on:
http://www.scienceprog.com/connect-lcd-to-atmega-using-3-wires/
Data pin is also used as a LCD RS pin. Here is my code:
Can you spot any obvious errors?
It's me again My last shit register troubles were, it turns out, really caused by a faulty breadboard. As the ultimate goal was to make a 3-wire LCD interface using a shift register I have now moved on to 74hc164 (8-bit shift-register) and made a simple circuit on a stripboard.
Filling the register by the use of the shiftout command on my picaxe 20x2 seems to be working correctly (checked by the LEDs connected to the register outputs). The problem arises when I try to connect the circuit to the LCD (that is working quite happily with the standard 6-wire interface) - I don't get any output.
My guess is that either my initialisation sequence is wrong or one of the pins idles in the wrong logic state (or possibly timing?). The circuit is based on:
http://www.scienceprog.com/connect-lcd-to-atmega-using-3-wires/
Data pin is also used as a LCD RS pin. Here is my code:
Code:
symbol LCDclockPin = C.0
symbol LCDdataPin = C.1
symbol setLCDdataPin = pinC.1
symbol LCDenablePin = C.2
symbol byt=b10
symbol i=b0
symbol cx=b1
output LCDdataPin
output LCDenablePin
output LCDclockPin
low LCDenablePin
low LCDdataPin
low LCDclockPin
setfreq m64
pause 1000
gosub LCD_init
main:
'pause 10000
eeprom 6,("Test")
for i=6 to 9
read i,byt
gosub LCD_char
next i
pause 10000
goto main
LCD_init:
byt=$30 : gosub LCD_cmd : pause 10
gosub LCD_cmd : pause 1
gosub LCD_cmd : pause 1
byt=$38 : gosub LCD_initcmd
'byt=$08 : gosub LCD_initcmd
byt=$0C : gosub LCD_initcmd
byt=$06 : gosub LCD_initcmd
byt=$01 : gosub LCD_initcmd
byt=$02 : gosub LCD_cmd : pause 60
'FOR i = 0 TO 5
' READ i,byt
' GOSUB LCD_initcmd
'NEXT
' Nibble commands - To initialise 4-bit mode
'EEPROM 0,( $30 ) ; %0011---- %0011---- 8-bit / 8-bit
'EEPROM 1,( $30 ) ; %0011---- %0010---- 8-bit / 4-bit
'EEPROM 2,( $30 ) ; %00101000 %001LNF00 Display Format
'EEPROM 3,( $38 ) ; %00001100 %00001DCB Display On
'EEPROM 4,( $0F ) ; %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
'gosub LCD_loaduserchar
pause 60
RETURN
LCD_initcmd:
PAUSE 60
; Delay 15mS
LCD_cmd:
'shiftout LCDclockPin,LCDdataPin,1,(0)
shiftout LCDclockPin,LCDdataPin,1,(byt/8)
low LCDdataPin
pulsout LCDenablePin,1
; Send to Command register
return
LCD_char:
'shiftout LCDclockPin,LCDdataPin,1,(0)
shiftout LCDclockPin,LCDdataPin,1,(byt/8)
high LCDdataPin
pulsout LCDenablePin,1
low LCDdataPin
cx=cx+1
return
Last edited: