gButton.gBitOperation Property

Top  Previous  Next

PROPERTY                                               DATA TYPE                       NOTE

gBitOperation

gBitOperation

Set, Reset, Invert

 

Defines effect of Button.Click event to specified bit of PLC address.

gButton should be in Bit mode. (gValueOrBit = Bit)

 

C# code example

gButton.gBitOperation = gBitOperation.Set;

gButton.gBitOperation = gBitOperation.Reset;

gButton.gBitOperation = gBitOperation.Invert;

 

 

 

Example - 1

If enum member is gBitOperation.Set, transforms state of specified bit  to 1 when click on gButton.

 

Suppose that PLCValue is 5 and gBitIndex is 1.

So bit value is 101 and value of specified is 0.

Then;

 

SetEnum

 

 

 

Example - 2

If enum member is gBitOperation.Reset, transforms state of specified bit to 0 when click on gButton.

 

In this time, suppose that PLCValue is 6 and gBitIndex is 1.

So bit value is 110 and value of specified bit is 1.

Then;

 

resetenum

 

 

 

 

 

Example - 3

If enum member is gBitOperation.Invert, if state of specified bit is 0, transforms  to 1; if  it's 1, transforms to 0,  when click on gButton.

 

Lastly, suppose that PLCValue is 7 and gBitIndex is 1.

So bit value is 111 and value of specified bit is 1.

Then;

 

Invert