Wow Richard, thanks for that! I guess I was way off. I used Melanie's Olympic Timer as the basis for my code and she included some of the things that you have advised against such as adding the SetTimer subroutine call in the Starttimer routine and INTCON.7=1.
I tried your code and needed to change a few things.
OSCCON = 110011
TRISA = 111000
TRISB = 010011
became
OSCCON = %01110011
TRISA = %11111000
TRISB = %00010011
in order to compile.
If you open the lid while its running and close it again, then push the start button, it doesn't turn on the outputs and start timing again. It does jump back to main, it will jump in to main1 and put the red led on solid, but doesn't run main1.
If the switch is in the 60 second run position it runs for about 10 seconds - which I saw you had runtime = 10 so I changed that.
In the 90 second position it runs for 90 seconds - perfect.
In the 120 second position it ends almost instantly. I noticed this would happen sometimes in my code too. 100 and less and it works each time. I don't know what this phenomena is.
Bookmarks