To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This VI determines Bit Values of a Numeric
Description
Usually, as a LabVIEW developers, when we need access to an individual bit of a numeric, we will use the Number to Boolean Array VI. Then, using the Index Array VI, we will pull out the bit of interest, as implemented in Single Bit Value from Numeric (using Index Array) VI. See also the block diagram in Additional Information or References.
However, this technique may not always be convenient or desired. When programming with LabVIEW FPGA, we are very concerned about utilizing the least amount of resources. In this case, it would be beneficial to have an alternative to the Index Array for finding the value of a bit of interest of a numeric. If only one bit is desired, the code is straight-forward, using the Bit-wise AND from the Boolean palette. Such implementation is as done in Single Bit Value from Numeric LV2012 NI Verified. See also the block diagram in Additional Information or References.
If the code requires the value of all of the bits to be found, one may want to use All Bit Values from Numeric LV2012 NI Verified. The Bit Accurate Data Size Property Node is used to programmatically handle different data types of the Input Numeric (U32) Control.
Requirements
LabVIEW 2012 or compatible
Steps to Implement or Execute Code
Additional Information or References
Single Bit Value from Numeric (using Index Array) VI Block Diagram
Single Bit Value from Numeric LV2012 NI Verified VI Block Diagram
All Bit Values from Numeric LV2012 NI Verified VI Block Diagram
Also-
**This document has been updated to meet the current required format for the NI Code Exchange. **
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
I don't understand the point of the code in figure 3. What makes it better than the plain, existing "number to boolean array"?
To second Christian's concern, if #3 is better than the Number to Bool Array, why is Num to Bool Array not just an inlined wrapper of #3?
If that code is truly better, perhaps the prim owner (or compiler) needs some optimization tasks in their strategic plan. ![]()