LED Maestro
Senior Member
Hi, This is the third time I have had to ask for help with regard to this problem, with the previous 2 times, thankfully, being solved but in two different ways each time. Now the problem has resurfaced. My DS1307 RTC, connected correctly to a Pic28X2 via the SDA, SCL lines with appropriate pull-up resistors. See code below. When I debug, the hours, minutes and seconds just stay at 255 ($FF). I have tried re-programming multipul times with and without the pull-ups, changine the Pic and the RTC module, none of which solve the problem.
I feel stupid for asking yet again but this is vital to my final year project at college and my electronics teacher does not understand my project concept and is reluctant to help me solve my I2C comms troubles that I am currently experiancing, hence why I am now here. I dont need to go into details about what I need it for, I just need to be able to read the time from the RTC.
Any help is, as always, greatly appreciated.
I feel stupid for asking yet again but this is vital to my final year project at college and my electronics teacher does not understand my project concept and is reluctant to help me solve my I2C comms troubles that I am currently experiancing, hence why I am now here. I dont need to go into details about what I need it for, I just need to be able to read the time from the RTC.
Any help is, as always, greatly appreciated.
Code:
#Picaxe28x2
symbol seconds = b0
symbol mins = b1
symbol hour = b2
symbol control = b3
; set PICAXE as master and DS1307 slave address
hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte
; write time and date e.g. to 17:06:00
start_clock:
let seconds = $00 ; 00 Note all BCD format
let mins = $06 ; 06 Note all BCD format
let hour = $17 ; 17 Note all BCD format
let control = %00010000 ; Enable output at 1Hz
hi2cout 0,(seconds,mins,hour, control)
main:
hi2cin 0,(b0,b1,b2,b3)
debug b1
pause 200
goto main