Browse FAQs

How to convert bits to an Integer in Vijeo Designer?

Published date: 30 April 2019

Issue:
How to convert bits to an Integer in Vijeo Designer?

Product Line:
Vijeo Designer (all versions)

Resolution:
To convert bits to be used an Integer variable in Vijeo Designer, please use a script as shown below:

boolean bitArray[] = new boolean[16];
 
int value = 0;
 
bitArray[0] = true;
bitArray[1] = true;
bitArray[2] = true;
bitArray[3] = true;
bitArray[4] = true;
bitArray[5] = true;
bitArray[6] = true;
bitArray[7] = true;
bitArray[8] = false;
bitArray[9] = false;
bitArray[10] = false;
bitArray[11] = false;
bitArray[12] = false;
bitArray[13] = false;
bitArray[14] = false;
bitArray[15] = false;
  
for (int i = 0; i < 16; i++) 
{
  if (bitArray[i])
  {
  value += 1 << i;
  }
}

TestINT.write(value); //TestINT is a Vijeo Designer INT variable that I created. This was just used to test the output.
 

Was this helpful?

What can we do to improve the information ?

Can't find what you are looking for?

Reach out to our customer care team to receive information on technical support, assistance for complaints and more.