Quote Originally Posted by kjavrd View Post
Hello all.

I dug around a bit and couldn't find a solid answer. I'm hoping this is a quick answer from someone.

Can I loop through the bit position in a variable by using another variable to represent the bit position?

For example,

I know I can do this:


MyVar.0 = 1
MyVar.1 = 1
MyVar.2 = 0 ... etc



I want do this:


n=0

MyVar.n = 1

... later in the loop, n is 5, so

MyVar.n = 0

etc.


I've compiled it and PBP doesn't seem to like it.

Much appreciated.
I had much the same question the other day - only with an I/O port. I think this will do it:

Code:
MyVar.0[n] = 0
As always, I stand to be corrected