First of all, I think I'm probably just having an understanding problem.
There is a pretty detailed example of Anombium how to handle DS3231_SetAlarm1.
But if I try this, the following happens.
I write a value in the minutes and when I read it out again it is wrong.
Example:
DS3231_SetAlarm1 ( 21, 11, 30, 0, 1 ) ;DS3231_SetAlarm ( [0 | 1] , HOUR, MINUTE, SECOND, DOW, DATE )
DS3231_ReadAlarm1( HOUR, min, sec, DOW, DATE )
I'm getting 91 back as a minute now. I expected 11
I think I don't need the function bcdtodec, it is already used in the ds3231.h.
Hour is correct by the way.
Therefore I am quite helpless now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all, I think I'm probably just having an understanding problem.
There is a pretty detailed example of Anombium how to handle DS3231_SetAlarm1.
But if I try this, the following happens.
I write a value in the minutes and when I read it out again it is wrong.
Example:
DS3231_SetAlarm1 ( 21, 11, 30, 0, 1 ) ;DS3231_SetAlarm ( [0 | 1] , HOUR, MINUTE, SECOND, DOW, DATE )
DS3231_ReadAlarm1( HOUR, min, sec, DOW, DATE )
I'm getting 91 back as a minute now. I expected 11
I think I don't need the function bcdtodec, it is already used in the ds3231.h.
Hour is correct by the way.
Therefore I am quite helpless now.
Check the high bit in the datasheet, you may have to mask the high bit.
Ok, min AND 0b00001111 works.
Thank you.