OK, i have have done a bit more digging and come up with this:
I have had to put theCode:Red VAR PORTB.1 Seconds var byte ' 0-59 Minutes var byte ' 0-5 Minutedelay var byte Minutedelay = 2 counter = 0 ' For Minutes = 0 to Minutedelay Gosub Delaymin If Minutes = Minutedelay - 1 then gosub flash Next Minutes Delaymin: For Seconds=0 to 59 Pause 1000 Toggle Red ' flashing light for reference Next Seconds Return Flash: For loop = 1 to 5 red = 1 pause 125 red = 0 pause 250 red = 1 pause 125 red = 0 pause 250 Next loop Return End
in as it would not stop at the MinuteDelay variable. ie if i wanted it to stop at 2 minutes, it would stop at 3, if i wanted to stop at 3, it would stop at 4 etc etc.Code:If Minutes = Minutedelay - 1 then gosub flash
Is there any other way to tidy up this routine?
Also, this routine is activated by, for argument sake, PORTC.0 going high. How would i place the abort code in. ie if the same button (PORTC.0) goes high during this routine, it stops the counting and jumps back to the main code awaiting an input instruction.
I have a CASE SELECT routine which selects different routines, depending on which button is pressed. This is just one of the routines.
Many thanks,




Bookmarks