Hi! Melanie
Is this write to convert seconds to bcd from decimals so that it can be written to ds1307.
What is the dec2bcd codes for minutes, hours, day, weekday, month, and year?Code:(((ssec & 0x70) >> 4) * 10) + (ssec & 0x0F)
Hi! Melanie
Is this write to convert seconds to bcd from decimals so that it can be written to ds1307.
What is the dec2bcd codes for minutes, hours, day, weekday, month, and year?Code:(((ssec & 0x70) >> 4) * 10) + (ssec & 0x0F)
The Queen has not been here for awhile, but maybe this will help
Code:READ_RTC: I2CREAD DS_SDA, DS_SCL, RTC, SEC_REG, [sec,mins,hr,day,date,mon,yr] SEC_T = sec & $70 SEC_T = SEC_T>>4 SEC_O = sec & $0F MIN_T = mins & $70 MIN_T = MIN_T>>4 MIN_O = MINs & $0F HR_T = hr & $70 HR_T = HR_T>>4 HR_O = hr & $0F MON_T = mon & $70 MON_T = MON_T>>4 MON_O = mon & $0F DATE_T = date & $70 DATE_T = DATE_T>>4 DATE_O = date & $0F YR_T = yr & $70 YR_T = YR_T>>4 YR_O = yr & $0F
Dave
Always wear safety glasses while programming.
That will give you the ones place.
From the manual
4.17.7. DIG
DIG returns the value of a decimal digit. Simply tell it the digit number (0 - 4 with 0 being the rightmost digit) you would like the value of, and voila.
B0 = 123 ' Set B0 to 123
B1 = B0 DIG 1 ' Sets B1 to 2 (digit 1 of 123)
Dave
Always wear safety glasses while programming.
Bookmarks