Hi Clare
Just a thought . For your application you said your were using the LAB-X1 Experimenter Board and that you are only interested in SW1-SW3
if that is the case you don't even need to use the PortB change interupt
you can do something like this and it should work give it a go
Isaac
' PicBasic Pro program to show button press on LED
' Define LOADER_USED to allow use of the boot loader.
Define LOADER_USED 1
OPTION_REG = $7f ' Enable PORTB pull-ups
loop:
PORTB = 0 ' PORTB lines low to read buttons
TRISB = $f0 ' Enable all buttons
' Check any button pressed to turn on LED
If PORTB.4 = 0 Then ' If 4th button pressed...
pause 50
if PORTB.4=0 Then
gosub Earth_Bond
Endif
Endif
If PORTB.5 = 0 Then ' If 3rd button pressed...
pause 50
if PORTB.5=0 Then
gosub Flash_Test
Endif
Endif
If PORTB.6 = 0 Then ' If 2nd button pressed...
pause 50
if PORTB.6=0 Then
gosub IR_Test
Endif
Endif
Goto loop ' Do it forever
End
Earth_Bond:
'==========
'your stuff here
return
Flash_Test:
'===========
'your stuff here
return
IR_Test:
'=======
'your stuff here
return
Bookmarks