Bitmasking mit einem Button möglich?

Bitmasking mit einem Button möglich?

Guten Tag
Ich habe eine Frage zum Bitmasking einer Variable mit bestehendem Wert. Dies ist meine Ausgangslage:
Ich habe eine Ganzzahl-Variable (Datentyp UDINT), welche einen bestehenden Wert hat und je nach Zustand der verschiedenen Bits einen Motorzustand anzeigt. Um den jeweiligen Zustand anzuzeigen habe ich ein Combi-Element eingesetzt. Somit ändert sich die Symbolfarbe je nach Zustand.
z.B. Motor gestartet, wenn:
Bit Nr.20 auf 1, alle anderen Bits sind egal.
oder Motor unter Sicherheitsverriegelung wenn:
Bit Nr.16 auf 1, alle anderen Bits sind egal.
Ich möchte nun aber über einen Button diese Zustände ändern können, resp. den Zustand der einzelnen Bits auf 1/0 stellen ohne das die anderen Bits sich verändern. Da das Combi-element nur Zustände auswertet, dachte ich man könnte vielleicht ein Bitmasking (eine OR-Bitmaske) machen, so das der bestehende Wert nicht überschrieben wird. Ist dies irgendwie möglich?
Vielleicht kann man so etwas mit VBA/VSTA machen? Ich habe jedoch hier gar kein Wissen und kann noch nicht damit umgehen. Ich weiss aber das es existiert und nützlich ist ;)
Ich wär Ihnen für Hilfe oder Tipps sehr dankbar!
Danke im Voraus!
Eine Zenon-Anfängerin

This is a migrated post! Originally posted on 26.06.2013 by user agroscope. 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