First of all you may replace the High and Low commands with:

variable=1 or variable=0

Memory and speed gain with this trick.


Now for the pin addressing (this was posted long ago by Dennis Saputelli):

pin_index var byte

pin_index=12

porta.0[pin_index]=1 'Sets PortB.4 high.

for a PIC 16F877 pin_index values are:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 pin_index
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 port bit
Port A Port B


16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 pin_index
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 port bit
Port C Port D


32 33 34 pin_index
0 1 2 port bit
Port B


Note that even though the Port A register does not have the upper bits physically, they do count.


Hope that helps,
Ioannis