I am using a picaxe 14m2 chip and a Serial LCD display (AXE033) with a clock upgrade
I have the chip in i2c mode and am trying to set the time and then display it on the LCD display
This is what I have so far
I have the chip in i2c mode and am trying to set the time and then display it on the LCD display
This is what I have so far
Code:
goto setup
goto main
main:
gosub readtime
gosub displaytime
debug
pause 100
goto main
setup:
pause 500 ‘ wait for display to initialise
hi2csetup i2cmaster,$C6,i2cslow,i2cbyte
symbol seconds = b0
symbol mins = b1
symbol hour = b2
symbol day = b3
symbol date = b4
symbol month = b5
symbol year = b6
symbol control = b7
; set DS1307 slave address
i2cslave %11010000, i2cslow, i2cbyte
; Initialise the clock - "Thu 2003-12-25 11:59:00"
let day = $02 ; 03 Note all BCD format
let year = $12 ; 03 Note all BCD format
let month = $04 ; 12 Note all BCD format
let date = $25 ; 25 Note all BCD format
let hour = $12 ; 11 Note all BCD format
let mins = $02 ; 59 Note all BCD format
let seconds = $00 ; 00 Note all BCD format
let control = %00010000 ; Enable output at 1Hz
writei2c 0,(seconds,mins,hour,day,date,month,year,control)
goto main
readtime:
; Read the clock time
readi2c 0,(seconds,mins,hour,day,date,month,year)
; Report time read
pause 500
debug
goto displaytime
displaytime:
hi2cout 0,(254,128,255) ‘ move to start of first line
pause 10
hi2cout 0,(seconds,mins,hour,day,date,month,year,control,255)
goto readtime
[code][/COLOR]
The clock does not appear to count on the debugger and there is nothing displayed on the LCD. Is the code correct?
Thanks for your help