-
Bit set question
Hi,
I want to set a particular bit of a word, so I am doing it this way:
If channel < 16 then
control1.(channel + 1) = 1
endif
I want to set the (channel + 1)th bit of control1 to 1. The complier does not like this. Do you know how else I can do this?
Thanks
-
control1.0(channel + 1) = 1
or
control1.1(channel) = 1
<br>
-
Thanks....so just to confirm
This command does change the (channel + 1)th bit right and not the 0th bit of control1?
-
Yes. The (channel + 1) bit.
By putting the .0 after the variable name, it forces PBP to use it as a BIT Array, regardless of what the original variable was defined as.
If you use .0 then it starts at bit0
If you use .5 it starts at bit5. An index value of 0 will set bit5. An index of 4 will set bit0 in the next byte.
<br>
-