; ; DS1307 RTC test routine ; ; I ran this with no battery on the DS1307. ; This uses the sqwout pin on the ds1307 to drive an interrupt routine ; to use: choose picaxe|run. Once it gets going you should see a debug dialog box ; with the values of the clock in the b registers as setup in the symbols lines ; it should count forward about every 1 seconds. ; ; copyright 2006, singlespoon ministries. Released under GPL v2 symbol seconds = b1 symbol mins = b2 symbol hour = b3 symbol day = b4 symbol date = b5 symbol month = b6 symbol year = b7 symbol control = b8 i2cslave %11010000, i2cslow, i2cbyte pause 100 start_clock: let seconds = $00 let mins = $13 let hour = $11 let day = $06 let date = $04 let month = $08 let year = $06 let control = %00010000 writei2c 0,(seconds,mins,hour,day,date,month,year,control) ; setup the int routine and then loop ; looking for high on portd (40x, portc if 28x) input 0, enable portD input 0, ; the first binary number is the mask, the second is the pins setint %00000001, %00000001 main: pause 40000 goto main interrupt: ; set up the interupts for the next tick if pin0 = 1 then pinhigh setint %00000001, %00000001 goto pinlow pinhigh: setint %00000000, %00000001 pinlow: ; get the clock and display readi2c 0,(seconds,mins,hour,day,date,month,year) debug b1 ; return