Hi Bob,

Actually, I used the PCF8563, which is virtually identical to the PCF8583 except for a few features.

Anyway, here are the RTC read and RTC write segments that I use. Since my RTC works on a battery (a CR2032, now in its second year, expected to go on for at least a year more!), I have also extracted the low battery indiactor bit.

'READ FRESH VALUES FROM THE RTC and convert BCD to decimal

I2CREAD SDA,SCL,$A2,2,[S,m,h,D,W,MN,Y] 'Read all parameters from the RTC

LOBATT = S & %10000000 ' Mask off all bits unimplemented in RTC registers
S = S & %01111111 '
M = M & %01111111 '
h = H & %00111111 '
D = D & %00111111 '
Mn = Mn & %00011111 '

TMP=S ' Convert BCD to decimal
S=((tmp>>4)*10)+(tmp & $0F) '
tmp=M '
M=((tmp>>4)*10)+(tmp & $0F) '
tmp=H '
H=((tmp>>4)*10)+(tmp & $0F) '
tmp=D '
D=((tmp>>4)*10)+(tmp & $0F) '
tmp=MN '
MN=((tmp>>4)*10)+(tmp & $0F) '
tmp=Y '
Y=((tmp>>4)*10)+(tmp & $0F) '


'Convert Decimal Seconds,Minutes & Hours values to BCD equivalents and write to RTC

tmp=S
S=(tmp dig 1<<4)+(tmp dig 0)
tmp=M
M=(tmp dig 1<<4)+(tmp dig 0)
tmp=H
H=(tmp dig 1<<4)+(tmp dig 0)
tmp=D
D=(tmp dig 1<<4)+(tmp dig 0)
tmp=MN
MN=(tmp dig 1<<4)+(tmp dig 0)
tmp=Y
Y=(tmp dig 1<<4)+(tmp dig 0)

I2CWRITE SDA,SCL,$A2,2,[S,M,H,D,W,MN,Y] 'Write parameters to RTC

Hope this helps!

Regards,

Anand