LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean array to signed integer

Solved!
Go to solution

Hi all,

 

I struggling with the following:

 

I read a 64-bit boolean array from a device. This boolean array represents a varying collection of numbers, either signed or unsigned.

I have the composition of the array, i.e. bit 1-15 is a signed 16-bit integer, bit 16-23 is an unsigned 8-bit integer and so on...

So I can divide the boolean array into the corresponding bit-arrays to convert them to numbers. For unsigned numbers I simply use the "boolean array to number" function and that works fine (output is a U32).

 

Now here's the problem: This does not work for signed integers... the output of the "boolean array to number" function is always an U32, even if I select "sign extension mode"=always from the context menu of the function, so a negative value can never be extracted.

 

Any suggestions of how to solve this? I've tried typecasting but I can't get it to work.

 

Regards,

 

PJ

0 Kudos
Message 1 of 4
(3,824 Views)
Solution
Accepted by topic author Pianne

Hi Pianne,

 

right-click the BoolArrayToNum function and set the correct output datatype in the properties!

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(3,821 Views)

Just right-click the "Boolean Array To Number" primitive, select Properties. On the Output Configuration tab, set the desired representation.

 

0 Kudos
Message 3 of 4
(3,820 Views)

DOH!   Smiley Embarassed

 

Thank you very much!

 

I overlooked that.

 

PJ.

0 Kudos
Message 4 of 4
(3,815 Views)