Hi Roy,
Commands that require a pin # already know the pin is asociated with a port.
So you just need to include the pin# for the command to use.
From the manual for the HIGH command;
Pin may be a constant, 0-15, or a variable that contains a number 0-15 (e.g.B0) or a pin
name (e.g. PORTA.0).
So you can still do what you want, but not with variable bit indexing.
Just use the actual pin # in your loops Index variable.
Code:
Index VAR BYTE
Main:
FOR Index = 0 TO 15 ' PORTB.0 to PORTB.7 = 0-7. PORTC.0 to PORTC.7 = 8-15
TOGGLE Index
PAUSEUS 100
TOGGLE Index
PAUSEUS 100
NEXT
GOTO Main
END
This same approach should work with any PBP command with a pin# in the argument list.
If you're using all of PORTC on the 877A for OWOUT, then your loop Index variable would
be from 8 to 15.
On a different PIC, this may change since there may only be PORTA and PORTB. Look in the
16F877A.BAS file for how the port pins are listed like this;
PORTL VAR PORTB ' <-- 0-7
PORTH VAR PORTC ' <-- 8-15
In 16F84A.BAS
PORTL VAR PORTB ' <-- 0-7
PORTH VAR PORTA ' <-- 8-12
Now the same code example above would operate a bit different. Starting on PORTB, and
finishing on PORTA, with 0 TO 12 as the loop Index count.
Bookmarks