Code:
PORTB=0
TRISB = 255 ' Disconnect all resistors from the circuit
' Some code here
DoItAgain: SELECT CASE XYZ CASE ABC TRISB.0 = 0 ' Connect PORTB.0 resistor to the circuit CASE DEF TRISB.0 = 0 ' Connect PORTB.0 resistor to the circuit TRISB.1 = 0 ' Connect PORTB.1 resistor to the circuit CASE GHI TRISB.0 = 0 ' Connect PORTB.0 resistor to the circuit TRISB.2 = 0 ' Connect PORTB.2 resistor to the circuit TRISB.3 = 0 ' Connect PORTB.3 resistor to the circuit END SELECT PAUSE 500 TRISB = 255 ' Disconnect all resistors GOTO DoItAgain