I use this routine and work
S var byte
M var byte
H var byte
symbol SCL = portc.3
symbol SDA = portd.0
DecimaleSec var byte
DecimaleMin var byte
DecimaleOra var byte
S1 var byte
S2 var byte
M1 var byte
M2 var byte
H1 var byte
H2 var byte
I2CREAD SDA,SCL,%10100001,2,[S]
I2CREAD SDA,SCL,%10100001,3,[M]
I2CREAD SDA,SCL,%10100001,4,[H]
You must convert BCD format
DecimaleSec = ((S >> 4) * 10) + (S & $0f)
S1 = DecimaleSec dig 1
S2 = DecimaleSec dig 0
DecimaleMin = ((M >> 4) * 10) + (M & $0f)
M1 = DecimaleMin dig 1
M2 = DecimaleMin dig 0
DecimaleOra = ((H >> 4) * 10) + (H & $0f)
H1 = DecimaleOra dig 1
H2 = DecimaleOra dig 0
LCDOUT dec(H1),dec(H2),":",dec(M1),dec(M2),":",Dec(S1),de c(S2)
Bookmarks