Quote Originally Posted by RHS_electronics View Post
thank you for all of your help, but is there a way to make it so that when you press the button it loops one program continously then, when pressed again goes to another program?
Untested but worth a try:
Code:
Button_Flag VAR BIT
DUMMY       VAR BYTE
Trisa = 32
Trisc = 0


a Var porta:c var portc
x var word:t1 var word


x=0
t1=200

ANSEL = 0
ioca=%00100000
CMCON0 = 7
start:

on interrupt goto buttonpressed
INTCON = %10001000 
DISABLE
buttonpressed:
IF Button_Flag = 1 THEN
    gosub All_on
    ELSE
    gosub LEFT
    endif
    dummy=porta  ; clear mismatch condition
    INTCON.0 = 0   ; reset interrupt flag

resume                     
ENABLE

 '...

DISABLE
all_on:
  a=7:c=63
  Button_Flag = 1
  pause t1
return
ENABLE

DISABLE
    LEFT:
    A=4 : c=36:
    Button_Flag = 0
    pause t1
a=0: c=0
pause t1
return
ENABLE