LED Maestro
Senior Member
Hi,
I have a DS1307 module hocked up to a picaxe 28x2 with SDA connected to pin 15 and SCL connected to pin 14 both with appropriate pull up resistors and an led connected to the SQW output which is flashing at a very steady rate I am glad to say. I have a small amount of code to set the time, date etc and then read it back in debug (see below). The problem is that in debug, all variables are stuck at 255, no movement, nothing! My wiring is certainly correct and both the chip and RTC module are new.
Any advice would be greatly appreciated
I have a DS1307 module hocked up to a picaxe 28x2 with SDA connected to pin 15 and SCL connected to pin 14 both with appropriate pull up resistors and an led connected to the SQW output which is flashing at a very steady rate I am glad to say. I have a small amount of code to set the time, date etc and then read it back in debug (see below). The problem is that in debug, all variables are stuck at 255, no movement, nothing! My wiring is certainly correct and both the chip and RTC module are new.
Any advice would be greatly appreciated
Code:
#Picaxe28x2
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 PICAXE as master and DS1307 slave address
hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte
; write time and date e.g. to 11:59:00 on Thurs 25/12/03
start_clock:
let seconds = $00 ; 00 Note all BCD format
let mins = $59 ; 59 Note all BCD format
let hour = $11 ; 11 Note all BCD format
let day = $03 ; 03 Note all BCD format
let date = $25 ; 25 Note all BCD format
let month = $12 ; 12 Note all BCD format
let year = $03 ; 03 Note all BCD format
let control = %00010000 ; Enable output at 1Hz
hi2cout 0,(seconds,mins,hour,day,date,month,year,control)
main:
hi2cin 0,(b0,b1,b2,b3,b4,b5,b6,b7)
debug b1
pause 2000
goto main