Page 1 of 1

Set Bit in a Num Gate value

Posted: Tue Mar 09, 2010 10:16 am
by user1
Is it possible to set a specific bit in a Num Gate Value in code?
You can check the bit status in a Num Gate Value with the Get Bit command?
Can you give me an example if this is possible.
Thank you for support.

Re: Set Bit in a Num Gate value

Posted: Tue Mar 09, 2010 3:01 pm
by Lorenzo
Yes, here it is a Winlog code example:

Function void CheckBit()
int Value;
Value=GetNumGateValue("N",1);
if GetBit(Value,2)==1 then
MessageBox("Bit 2=1","");
else
MessageBox("Bit 2=0","");
end
end


Function void SetBit()
int Value;
Value=GetNumGateValue("N",1);
Value=SetBit(Value,2);
SetNumGateValue("N",1,Value);
end