I get it now ....
In my case, all of the reassigned inputs use the PULSIN command. I simply assign a variable to the pin portion of the PULSIN command, separate from the resulting input data variable.
Thanks Darrel! Much appreciated.
I don't like needing to check the compiler files for information, because changing PICs can be a hassle, especially when you forget about it.
When I did it (years ago) I had to do something like this...
myPIN = 2 ...set this in your IF statements
low portb.0[myPIN] ...allows you to use any port you like, and changing PICs is easy.
>myPIN = 2 ...set this in your IF statements
>low portb.0[myPIN]
That would READ PORTB.2, and set either PORTB.0 or PORTB.1 low depending on the state of RB2(0 or 1).
portb.0[myPIN] = 1 ; lets you control any pin, assuming TRIS has been set
But it can't be used in SERIN/OUT, PULSIN/OUT, RCTIME, HIGH/LOW, etc., like the PIN numbers can.
DT
With most PBP statements, you only have 3 options for the PIN's.
It's usually described like this in the manual ...
But portb.0[myPIN] is an Array operation.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).
The only one of the 3 options that fits an array result is "or a variable that contains a number 0-15".
In order to know which PIN to use, it has to READ the variable, or in this case do the array operation (reading a PIN).
Since it's a BIT array, it will only see a 1 or a 0.
hth,
DT
Either we are miscommunicating, or they have changed the way bit arrays work, or you must be misunderstanding bit arrays. I have been using this method for 8 years:
PORTB.0[PinToChange] = NewPinState
The value for PinToChange can be any number 0 to7, and this allows you to use it on ANY PORT. The value for NewPinState must be 0 or 1.
PORTA.0[4] = NewPinState
PORTB.0[4] = NewPinState
Will set PortA.4 AND PortB.4 to the NewPinState
Bookmarks