MCP7940-RTC-Library, bugs , set second and month bit mask

bug 1)
Setting second not working
in set function is
int state=rtc_bcd[MCP7940_SEC] & MCP7940_CLOCKHALT;
but because
#define MCP7940_CLOCKHALT B01111111
and state is store in highest bit
there should be
int state=rtc_bcd[MCP7940_SEC] & ~(MCP7940_CLOCKHALT);

bug 2) month bit mask
high month bitmask is only one bit, not two
#define MCP7940_HI_MTH B00110000
http://ww1.microchip.com/downloads/en/DeviceDoc/20002292B.pdf
should be
#define MCP7940_HI_MTH B00010000

Solution tested.

Issue submited on github. https://github.com/radupietraru/MCP7940-RTC-Library/issues/1

 

Jiri Pek
Jiri Pek
10
| 1 0 2
Asked on 9/3/20, 1:28 PM
0
vote
1062 Views

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

63 follower(s)

Stats

Asked: 9/3/20, 1:28 PM
Seen: 1062 times
Last updated: 9/3/20, 2:45 PM