Counting bits


Recommended Posts

Hi

I have a stupid question..

I'm trying to sum up some bits (to see how many are active) and I got into some sort of a problem, you'll probably have no problem with..

When I paste the following into the watch monitor it works

(from.Bit(bit1)+from.Bit(bit2)+from.Bit(bit3)
+from.Bit(bit4)+ From.Bit(bit5)+From.Bit(bit6))

I get a nice number of active bits..

but when I put the code in a sequence and assign it to a global variable it does not work..

test=(from.Bit(bit1)+from.Bit(bit2)+from.Bit(bit3)
+from.Bit(bit4)+From.Bit(bit5)+From.Bit(bit6))

Strange numbers appear..

What do you think could be the problem or am I handling it wrong and should do it another way?

thank you!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.