Modifying bit in Word

Modifying bit in Word

Hello!

Sorry for my bad English, but I hope you will get me!

Can I write/modify a bit in a whole Word variable with a Button, Combined Element or anything else?

As you know, a Word variable got 16 bit (so every bit can be 0 or 1). So I would like to modify the first 4 bits by 4 buttons (button 1 is linked with bit 0, button 2 is linked with bit 1 …etc.). Every button must modify just one bit and not the others.

To be more specific in what I need. For example, the button 2 is ON and the others are OFF (then the value of the word is 2). If I turn on the button 3, the value of the Word should get 6 (bit1=2, bit2=4, 2+4=6). Then If I turn off the button 2, the value should get 4 and not 0.

May can I use such like a script or a programming thing to do that?

Best regards.

This is a migrated post! Originally posted on 08.07.2021 by user mmadrati. Please be aware that information can be outdated.