jayanth.devarayanadurga
Banned
- Joined
- Dec 4, 2012
- Messages
- 4,280
- Helped
- 822
- Reputation
- 1,654
- Reaction score
- 791
- Trophy points
- 1,393
- Location
- Bangalore, India
- Activity points
- 0
To set hour register of DS1307 I need to write these values
12 AM 0x40
01 AM 0x41
02 AM 0x42
03 AM 0x43
04 AM 0x44
05 AM 0x45
06 AM 0x46
07 AM 0x47
08 AM 0x48
09 AM 0x49
10 AM 0x50
11 AM 0x51
12 PM 0x72
01 PM 0x61
02 PM 0x62
03 PM 0x63
04 PM 0x64
05 PM 0x65
06 PM 0x66
07 PM 0x67
08 PM 0x68
09 PM 0x69
10 PM 0x70
11 PM 0x71
My hr, min, sec variables hold values
0, 1, 2, 3, 4, 5, 6 7, 8, 9, 10, 11, 12, and I have to use Dec2BCD and convert
40, 41, 42, 43,...52 and 61, 62,...71 to BCD and write it to hours register.
Is there any formula to convert 1, 2, 3, 4, 5,...12 to 40, 41, 42,....52 and 61, 62, 63,...71
I need this for the Set_Time() function in my code.
12 AM 0x40
01 AM 0x41
02 AM 0x42
03 AM 0x43
04 AM 0x44
05 AM 0x45
06 AM 0x46
07 AM 0x47
08 AM 0x48
09 AM 0x49
10 AM 0x50
11 AM 0x51
12 PM 0x72
01 PM 0x61
02 PM 0x62
03 PM 0x63
04 PM 0x64
05 PM 0x65
06 PM 0x66
07 PM 0x67
08 PM 0x68
09 PM 0x69
10 PM 0x70
11 PM 0x71
My hr, min, sec variables hold values
0, 1, 2, 3, 4, 5, 6 7, 8, 9, 10, 11, 12, and I have to use Dec2BCD and convert
40, 41, 42, 43,...52 and 61, 62,...71 to BCD and write it to hours register.
Is there any formula to convert 1, 2, 3, 4, 5,...12 to 40, 41, 42,....52 and 61, 62, 63,...71
I need this for the Set_Time() function in my code.
Last edited: