Look in the .bas file for the chip you are using.
If it's a 16F877A then open c:\pbp\16f877a.bas
The PORTL and PORTH aliases are used for the PIN numbers (0-15)
PORTL is 0-7 and PORTH is 8-15.
Code:
PORTL VAR PORTB
PORTH VAR PORTC
TRISL VAR TRISB
TRISH VAR TRISC
If PORTH is aliased to PORTC then you don't need to do anything.
If it's not, change it to PORTC, and change TRISH to alias TRISC.
Then you can use the PIN numbers to access the pins with a variable.
Code:
If DS1=1 then
ComVar=14 ; PORTC.6
Else
ComVar=13 ; PORTC.5
EndIF
Serout2 ComVar, 84, [“ Com is PIN - ”, DEC ComVar,13,10]
Bookmarks