Hi John,
There's no way to do that with standard PBP commands. Normal PBP arrays must be completely contiguous. However, we can create a new command with a little assembly language.
This isn't exactly what you were looking for, but it does accomplish the exact same thing.
Put this code near the top of your program.
Code:
'------[ PortOut macro ]----------------
Temp_idx VAR byte
Temp_State VAR BIT
ASM
PortOut macro idx, state
MOVE?BB idx, _Temp_idx
MOVE?CT state, _Temp_State
EndASM
if Temp_idx < 5 then
PORTA.0[Temp_idx] = Temp_State
else
Temp_idx = Temp_idx - 5
PORTC.0[Temp_idx] = Temp_State
endif
@ endm
'---------------------------------------
Then you can simply do this...
Code:
for x = 0 to 9
@ PortOut _X, 1
next x
With this code, the state("1" in this case) must be a constant. I did it that way just to be consistant with your request.
If you wanted to use a variable instead, simply change this line in the PortOut routine...
MOVE?CT state, _Temp_State
-- changed to --
MOVE?TT state, _Temp_State
HTH,
Darrel
Bookmarks