your mainloop is unnecessarily long
firstly
I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RT CCtrl]
why read these when they are never used
second
Pause 20 why ????
third
all these never change why are they in the loop
PortA.2 =0
PortA.4 =0
PortC.0 =0
PortC.1 =0
and finally
you are reading the time hundreds of times a second when it can only change once a second
why not
count var word
count=1000
mainloop:
if count = 1000 then
I2CRead SDApin,SCLpin,$D0,$00,[RTCSec]
count =0
gosub bcd_to_bin
endif
count=count+1
temp1_sec = temp1
n = temp1_sec
PortA.0 =1
gosub display
PortA.0 =0
temp2_sec = temp2
n = temp2_sec
PortA.1 =1
gosub display
goto Mainloop
end
Bookmarks