Are these all the same variable type? You’re not showing variable declarations in the code you posed.
If so, you can make it an array and step through them in the I2C Read and WriteCode:RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl
hopefully you can use array elements in PBP I2C commands and it doesn’t stuff up:
It’s been a while since I used one of the RTCs, but I think you send zero values to fill the command.Code:for i = 0 to 6 I2CRead SDApin,SCLpin,$D0+i,$00,[RTCvar[i]] next i
EDIT,,
I think this will be slightly cheaper, maybe only a word:
Code:CounterA=(RTCHour>>4)&$03 If RTCHour.6=1 then ' Work-Out 12 or 24 hour Display for Hours CounterA=(RTCHour>>4)&$01 endif




Bookmarks