Hello
I need your help, please :
I stored all my my DEC value in a table :
Code:
unsigned char DEC_set_time_rtc[19] = "- --/--/-- --:-- --";
DEC_set_time_rtc[0] is DAY
DEC_set_time_rtc[1] is ' ' space character
DEC_set_time_rtc[2] is DATE (x10)
DEC_set_time_rtc[3] is DATE (unit)
DEC_set_time_rtc[4] is '/' character
DEC_set_time_rtc[5] is MONTH (x10)
DEC_set_time_rtc[6] is MONTH (unit)
DEC_set_time_rtc[7] is '/' character
DEC_set_time_rtc[8] is YEAR (x10)
DEC_set_time_rtc[9] is YEAR (unit)
DEC_set_time_rtc[10] is ' ' space character
DEC_set_time_rtc[11] is HOUR (x10)
DEC_set_time_rtc[12] is HOUR (unit)
DEC_set_time_rtc[13] is ':' character
DEC_set_time_rtc[14] is MIN (x10)
DEC_set_time_rtc[15] is MIN (unit)
DEC_set_time_rtc[16] is ' ' space character
DEC_set_time_rtc[17] is SEC (x10)
DEC_set_time_rtc[18] is SEC (unit)
DEC_set_time_rtc[19] is '\0' character
Then i convert each values to BCD and store each in a BCD table :
Code:
unsigned char BCD_set_time_rtc[] = "- --/--/-- --:-- --";
Code:
BCD_set_time_rtc[0] = dec2bcd(DEC_set_time_rtc[0]
BCD_set_time_rtc[2] = dec2bcd(DEC_set_time_rtc[2]);
BCD_set_time_rtc[3] = dec2bcd(DEC_set_time_rtc[3])
... etc ...
Once my BCD table is filled-in and ready, i would like to know how i should send the high and low bytes to registers.
How should i concatenate high and low bytes and send them to register ?
I think about this, but not sure it is the good way to proceed :
Code:
char tmp;
BCD_set_time_rtc[2] = (tmp << 4);
BCD_set_time_rtc[3] = ????? i don't know
RTC_write(0x84, tmp);
I'm not confortable with masking and shifting.
Many thanks for your help,