Im trying to capture the 60Hz mains signal count the pulses up to 600, then go and do the subroutine "addtenthhour", then update the display. Then return to counting the incoming pulses, hit 600 and do it all over again.
However, it aint working.
My input is RA5, I have a 0-4.5v square wave coming into the pin. Its robust and is clean on the scope.
What the heck am I missing here??
MainLoop:
A0 = 0
IF PORTA.5 = 1 THEN A0 = A0 + 1
A1 = A0
IF A1 = 600 THEN AddHourTenth
Gosub DisplayRefresh
Goto MainLoop
AddHourTenth:
HoursL = HoursL + 1
IF HoursL = 0 THEN HoursH = HoursH + 1
IF (HoursH = $F) and (HoursL = $4240) then ; Roll over at 1,000,000
HoursH = 0 ; 99999.9 + .1
HoursL = 0
endif
GOSUB WriteHours_EE
A1 = 0
Return
Bookmarks