Hi all.
I am trying to use a DS1307 RTC with an 18M2 picaxe.
I've read and re-read the data sheet and tutorial but must be missing something fundamental as my code appears not to work.
Here it is:
This is my first foray into the world of the i2c bus and as yet I have no way of checking that the time is correct, what I hope to achieve is pin 7 of the DS1307 flashing an LED at 1Hz.
I'm sure that the program uploads and runs at least partially as pin b.3 goes high when the button connected to pin b.2 is pressed.
I must admit to being being slightly confussed by the different addresses and what must and must note be stored in BCD.
Any help would be much appreciated.
Thanks.
I am trying to use a DS1307 RTC with an 18M2 picaxe.
I've read and re-read the data sheet and tutorial but must be missing something fundamental as my code appears not to work.
Here it is:
Code:
#picaxe 18M2
#no_data
symbol seconds = b0
symbol mins = b1
symbol hours = b2
symbol day = b3
symbol date = b4
symbol month = b5
symbol year = b6
symbol control = b7
HI2CSETUP i2cmaster, %11010000, i2cslow,i2cbyte
main:
if pinb.2=1 then
let seconds = $00
let mins = $59
let hours = $8
let day = $3
let date = $25
let month = $12
let year = $03
let control = $0001000
hi2cout 0,(seconds,mins,hours,day,date,month,year,control)
high b.3
pause 2000
low b.3
endif
goto main
I'm sure that the program uploads and runs at least partially as pin b.3 goes high when the button connected to pin b.2 is pressed.
I must admit to being being slightly confussed by the different addresses and what must and must note be stored in BCD.
Any help would be much appreciated.
Thanks.
Last edited by a moderator: