Menu

DS3231 Strange result of Alarm

bed
2019-03-17
2019-03-17
  • bed

    bed - 2019-03-17

    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.

     
  • Anobium

    Anobium - 2019-03-17

    Check the high bit in the datasheet, you may have to mask the high bit.

     
  • bed

    bed - 2019-03-17

    Ok, min AND 0b00001111 works.
    Thank you.

     

Log in to post a comment.