I have added a button to increase the minutes or seconds of a DS3231 module by 1 (one) each time it is pushed:
Note: "min_sec" is the current read of the appropriate register in the RTC.
There is no check for reaching "60." Of course, it is no big strain to add that test. Does anyone know what happens if you try to write a "60" in BCD to the minutes or seconds registers?
Just FWI, since some of you may not have played with these devices in awhile: BCD "59" = b'01011001'
and BCD "60" = b'01100000'
I thought I would ask before just trying it.
Regards, John
Code:
Increment
movlw 7
addwf min_sec,w ;test if low nibble =9
btfsc STATUS,1 ;test DC
goto Done
incf min_sec,w
Done
nop ;this will be a call with value in w to "WriteOneByte"
There is no check for reaching "60." Of course, it is no big strain to add that test. Does anyone know what happens if you try to write a "60" in BCD to the minutes or seconds registers?
Just FWI, since some of you may not have played with these devices in awhile: BCD "59" = b'01011001'
and BCD "60" = b'01100000'
I thought I would ask before just trying it.
Regards, John
Last edited: