Hi all,
Spent the most of teh day trying to wrap my head around a bit of code I was trying to create. Working on a project to use a 08M PICAXE to drive an LCD using some help from a 74HC595 shift register. I had teh LCD wired in manual mode and it work perfectly but now I am trying to do teh same via code with no luck. I am using a routine i found out there on teh web to blast a bit at a time to the shift register so that the outputs can have the value i need to send to the LCD. my code so far is in development with me trying to just send teh init commands.
I tried the below code but did not get the shiftreg to keep the value i sent this is confirmed by putting a led in series with a rsistor against each pin I expected to be high.
the Serout of the 8m is linked to the DS of the shiftreg
output 1 of the pic is being used as my clock pulse pin
both clocks are tied together on the shiftreg ( read somewhere that this was one way of doing it but would require an extra clock cycle to full the data register)
OE is tied low as well as SRCLR of the shift reg
any help in nudging me along would be great
==============================================================================
#Picaxe 08M
SYMBOL SERIALDATAPIN = 0
SYMBOL CLOCK = 1
SYMBOL RS = 2 ; 0 - Command Mode 1 - Data Mode
SYMBOL LCD_ENABLE = 4
SETFREQ M4
pause 1000
gosub INIT_LCD
main:
goto main
INIT_LCD:
LOW RS
;for the shift register
HIGH CLOCK
let b1 = 56 ; 8bit mode 2lines 5x7 matrix
;SERTXD(#b1)
gosub SHIFT_OUT
pause 5
; for the LCD
HIGH LCD_ENABLE
pause 2
LOW LCD_ENABLE
let b1 = 15 ; Turn on cursor to blink
;SERTXD(#b1)
gosub SHIFT_OUT
pause 5
; for the LCD
HIGH LCD_ENABLE
pause 2
LOW LCD_ENABLE
RETURN
SHIFT_OUT:
HIGH CLOCK
let b2=b1
let b4=0
for b3=0 to 7
b4 = b2 & %00000001
if b4=0 then
LOW SERIALDATAPIN
else
HIGH SERIALDATAPIN
endif
pulsout CLOCK,1
b2 = b2 /2
pause 20
;wait 2
next b3
pulsout CLOCK,1
RETURN