Long way, but possibly a fix is to incorporate the test for switch in each program
Code:
main:
if portb.2 = 1 then
switch = switch +1
If switch = 1 then goto program1
If switch = 2 then goto program2
If switch = 3 then goto program3
endif
goto main
program1:
HIGH PORTB.1
PAUSE 500
LOW PORTB.1
PAUSE 500
if portb.2 = 1 then
switch = switch +1
If switch = 1 then goto program1
If switch = 2 then goto program2
If switch = 3 then goto program3
endif
GOTO program1
program2:
HIGH PORTB.2
PAUSE 500
LOW PORTB.2
PAUSE 500
if portb.2 = 1 then
switch = switch +1
If switch = 1 then goto program1
If switch = 2 then goto program2
If switch = 3 then goto program3
endif
GOTO program2
program3:
HIGH PORTB.3
PAUSE 500
LOW PORTB.3
PAUSE 500
if portb.2 = 1 then
switch = switch +1
If switch = 1 then goto program1
If switch = 2 then goto program2
If switch = 3 then goto program3
endif
GOTO program3
crude code, but may work (I've not tested as I'm at work)
Bookmarks