Hello,
I need some help - again.
Struggling with the Tiny RTC Module.
I got as far as setting the time, and i can actualy read and display it on the Oled. Most of the code I snipped out of the several posts here.
Problem now is that the Time (Hour, Min, Sec) sporadically jump back & forth. Hour does not seem to increase.
Here is some output
16:19:33
16:19:35
16:19:33
16:19:34
16:19:40
16:19:42
16:19:43
16:19:41
16:19:42
16:19:48
16:19:50
16:19:51
16:19:49
16:19:51
16:19:56
16:19:58
16:19:59
16:16:01
16:16:03
16:16:00
16:16:02
16:16:08
Shows the same values on variables (debug screen), sertxd output as on the Oled.
setup:
08m2 on 08 Proto Board.
Tiny RTC module
4,7K Pullup resistors for both SDA SCL
Connectors between the proto board and the RTC are short, max 4" -tried different ones - no change
Stable 4.5V - also tried down to 3.3V - no change
The read in variables seem garbled, coming like that from the rtc module...
Code is from this forum posts here - with minor adaptations for language and format.
Any ideas what else to try? Different pullups?
Any input appreciated
Mike
I need some help - again.
Struggling with the Tiny RTC Module.
I got as far as setting the time, and i can actualy read and display it on the Oled. Most of the code I snipped out of the several posts here.
Problem now is that the Time (Hour, Min, Sec) sporadically jump back & forth. Hour does not seem to increase.
Here is some output
16:19:33
16:19:35
16:19:33
16:19:34
16:19:40
16:19:42
16:19:43
16:19:41
16:19:42
16:19:48
16:19:50
16:19:51
16:19:49
16:19:51
16:19:56
16:19:58
16:19:59
16:16:01
16:16:03
16:16:00
16:16:02
16:16:08
Shows the same values on variables (debug screen), sertxd output as on the Oled.
setup:
08m2 on 08 Proto Board.
Tiny RTC module
4,7K Pullup resistors for both SDA SCL
Connectors between the proto board and the RTC are short, max 4" -tried different ones - no change
Stable 4.5V - also tried down to 3.3V - no change
The read in variables seem garbled, coming like that from the rtc module...
Code is from this forum posts here - with minor adaptations for language and format.
Code:
#rem
I2C DS1307 / DS3231 RTC set / test program
Note. the data to/from RTC is in BCD format
2400,8,N,1 OLED / LCD on pin c.4
HIT PROGRAM 20 SEC BEFORE ACTUAL TIME
#endrem
; Funktioniert FAST --- Anzeige Tag, Datum so weit ok,
; Uhrzeit - seltsame Spr?nge
; Anzeige Interne Spannung --> OK!
#picaxe 08M2
#no_data
;#terminal 4800
symbol baud = N2400
symbol oled = C.4
symbol seconds = b0
symbol mins = b1
symbol hour = b2
symbol day = b3
symbol date = b4
symbol month = b5
symbol year = b6
symbol control = b7
symbol temp = b8
init:
hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte ;set RTC slave address
pause 800
serout oled,baud,(254,1)
pause 100
;uncomment the line below to update the clock time
;goto set_clock
main: ;read time and date, send to display
do
hi2cin 0,(seconds,mins,hour,day,date,month,year)
pause 100
bcdtoascii seconds,b10,b11
bcdtoascii mins,b12,b13
bcdtoascii hour,b14,b15
bcdtoascii date,b16,b17
bcdtoascii month,b18,b19
bcdtoascii year,b20,b21
select case day ;converts 'day' variable to day of week for display
case 1 serout oled,baud,(254,128," Mo ")
case 2 serout oled,baud,(254,128," Die")
case 3 serout oled,baud,(254,128," Mi ")
case 4 serout oled,baud,(254,128," Do ")
case 5 serout oled,baud,(254,128," Fr ")
case 6 serout oled,baud,(254,128," Sa ")
case 7 serout oled,baud,(254,128," So ")
endselect
serout oled,baud,(254,133,b16,b17,".",b18,b19,".20",b20,b21) ;positioned for 20X4 or
pause 500
serout oled,baud,(254,193,b14,b15,":",b12,b13,":",b10,b11) ;16X2 char display
calibadc10 w2
w2 = 10486/w2
bintoascii w2,b6,b7,b8
serout C.4,baud,(254,203,b7,".",b8,"v")
Sertxd (b14,b15,":",b12,b13,":",b10,b11, cr,lf)
pause 800
loop
set_clock: ;write time and date e.g. 08:52:00 on Sat 01/03/14
;Monday is day 1, Sunday is day 7
let seconds = $00 ;00 secs
let mins = $35 ;52 mins
let hour = $16 ;18 hours
let day = $01 ;02 day of week
let date = $16 ;16 day
let month = $10 ;10 month
let year = $17 ;17 year
let control = %00010000 ;Enable output at 1Hz
hi2cout 0,(seconds,mins,hour,day,date,month,year,control)
goto main
Any ideas what else to try? Different pullups?
Any input appreciated
Mike