You could use PIN numbers instead of PORT.bit.
Or, a similar version.Code:InputSelect VAR PORTB.0 myPIN VAR BYTE Test: IF InputSelect = 1 THEN myPIN = 1 ; PORTB.1 selected ELSE myPIN = 2 ; PORTB.2 selected ENDIF HIGH myPIN PAUSE 500 LOW myPIN PAUSE 500 GOTO Test
The Inputselect will always read 0 or 1. Add 1 to it to make 1 or 2, for PORTB.1 and PORTB.2.
The ports used depends on the chip you are using.Code:InputSelect VAR PORTB.0 myPIN VAR BYTE Test: myPIN = InputSelect + 1 HIGH myPIN PAUSE 500 LOW myPIN PAUSE 500 GOTO Test
Check the .bas file for the PIC you are using in the PBP folder. (ex. 16F877a.bas)
PORTL and TRISL determine which PORT that pin numbers 0-7 go to.
PORTH and TRISH determine which PORT that pin numbers 8-15 go to.
<br><br>




Bookmarks