You can use pin "Numbers".

But the pins will need to be grouped within 2 full ports, instead of scattered like you've shown.
Preferably PORTB and PORTC.
0-7 is PORTB, 8-15 is PORTC, but they can be changed in the 16F877.bas file.

Can I add ports A D and E somehow to the BAS file? I screwed aroud with trying to change the ports during runtime, but that doesn't seem to work.



for i = 0 to 15
serout2 i, 8276, ["hello, this is PIN# ",DEC i]
PAUSE 300
next i

i = 0
PORTL = A
PORTH = D
TRISL = A
TRISH = D

for i = 0 to 15
serout2 i, 8276, ["hello, this is PIN# ",DEC i + 16]
PAUSE 300
next i

next i