One of those "DUH!" moments.

fernando_g

Senior Member
During the longest of times, on any program on which I have used a RTC clock, I have used a routine similar as follows to update the time on the RTC from the serial terminal:

Code:
SERRXD mins, hours 'receive data in binary
' convert the binary to BCD
hinibble = mins/10 *16
lonibble = mins//10
BCD_mins = hinibble+ lonibble
hinibble = hours/10 *16
lonibble = hours//10
BCD_hours = hinibble+ lonibble
and then I proceed to write via I2C to the RTC chip.

Then, after one too many updates, I noticed the following symbol on the bottom of the serial terminal:

Capture.PNG

Which means that I can send values in Hex. Correct?
As BCD is basically truncated Hex, this means that I can send the time with a "$" appended, and then I don't require to perform all the binary to BCD conversion routine,

.................correct??
 
Last edited:
Top