Spin - Accessing individual bits - sort of like Bit0
Deskguy
Posts: 32
Hi,
New to Spin, so perhaps a dumb question (but I have looked through the manual and the forums).
Is there some sort of easy way to grab individual bits from a variable?
Pseudocode example:
TestBit1 := BigVariable.Bit1
TestBit2 := BigVariable.Bit2
...
Also:
BigVariable.Bit2 := %1
BigVariable.Bit7 := %0
Thanks in advance to anyone who can help point me in the right direction.
Best regards,
David
Post Edited (Deskguy) : 12/26/2008 4:18:21 PM GMT
New to Spin, so perhaps a dumb question (but I have looked through the manual and the forums).
Is there some sort of easy way to grab individual bits from a variable?
Pseudocode example:
TestBit1 := BigVariable.Bit1
TestBit2 := BigVariable.Bit2
...
Also:
BigVariable.Bit2 := %1
BigVariable.Bit7 := %0
Thanks in advance to anyone who can help point me in the right direction.
Best regards,
David
Post Edited (Deskguy) : 12/26/2008 4:18:21 PM GMT
Comments
Using the code that you have for setting the individual bits in "BigVariable", are there any potential traps that I should know about if I use that code to set all 8 bits separately, and then use "BigVariable" to do something?
(BTW, trying to use this for a few purposes, but in part as a 2 dimensional array - where the individual bits represent the second dimension)
Thanks again.