OK, here it is.
There is a considerable delay with the toggles. Sometime they don't react at all. I'm still trying other approaches to get the same effect but faster and more accurate. I'll keep you posted.
Thanks again for all your help
'Chip Registers
CMCON = 7 'disable comparators
TRISA = %11111111 'PortA inputs
TRISB = %00000000 'Portb outputs
'Declare and init vars
sw0 var porta.0 'Switches
sw1 var porta.1
sw2 var porta.2
sw3 var porta.3
led0 var portb.0 'LEDs
led1 var portb.1
led2 var portb.2
led3 var portb.3
MaskSwitch var byte 'Select/Case Var
portb = %00000000 'Set portb low
start:
MaskSwitch = porta & $0F 'Still trying to get my hands
'around this one.
Select Case Maskswitch 'Wait for user input
case 1
gosub sw0_proc
case 2
gosub sw1_proc
case 4
gosub sw2_proc
case 8
gosub sw3_proc
End select
Goto start
sw0_proc: 'Stop waitin and start workin
while sw0
toggle led0
wend
return
sw1_proc:
while sw1
toggle led1
wend
return
sw2_proc:
while sw2
toggle led2
wend
return
sw3_proc:
while sw3
toggle led3
wend
return
end
Bookmarks