Get Bit in Tag of Integer type in Panel Builder 600
Hi,
I have a problem to get the status of any bit in the tag of integer type using JavaScript. I tried to write project.getTag("/K6_Communication/oP_Status,10") to get the status of the 10th bit in the tag oP_Status but it doesn't work. What is the correct syntax? Thanks
Voted best answer
You can't access the bit directly for INT type in the JavaScript.
The workaround are as below:
var Value1 = project.getTag("Tag1");
var Value2 = 4; //Select Bit Location in decimal, example Bit0=1, Bit1=2, Bit3=4, Bit4=8...
var Value3 =V alue1 & Value2;
if (Value3 == 0) {
project.setTag("Tag2",0);
}
if (Value3 /= 0) {
project.setTag("Tag2",1);
}
Add new comment