Can anyone help with is code only problem is that it dose not no about 28 days or 30/31 days in a month is there anyone who can have a look few my code and maybe point me in the right direction
Kind Regards
Chris
#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," Tu")
case 3 serout oled,baud,(254,128," We ")
case 4 serout oled,baud,(254,128," Th ")
case 5 serout oled,baud,(254,128," Fr ")
case 6 serout oled,baud,(254,128," Sa ")
case 7 serout oled,baud,(254,128," Su ")
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)
Sertxd (b14,b15,":",b12,b13,":",b10,b11, cr,lf)
Debug
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 = $26 ;00 mins
let hour = $11 ;00 hours
let day = $01 ;05 day of week
let date = $30 ;30day
let month = $05 ;05 month
let year = $2022 ;22 year
let control = %00010000 ;Enable output at 1Hz
hi2cout 0,(seconds,mins,hour,day,date,month,year,control)
goto main