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.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com