In addition to sougata's, here is a conversion from Melanie's.
You need to convert your decimal values to HEX values and then you can write the HEX values to your RTC chip.
Code:
DecVal = HOUR
GOSUB ConvertBCD
HOUR = HEXVal
'Now you set your RTC chip with this new HOUR variable (which is now in HEX).
ConvertBCD:
HEXVal = DecVal DIG 1
HEXVal = HEXVal <<4
HEXVal = HEXVal + DecVal DIG 0
RETURN
----------------
Edit: also take a look at this post here: http://www.picbasic.co.uk/forum/showthread.php?t=110
Bookmarks