From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Convert U32 Elements to Binary

Code and Documents

Attachment

Overview
This example VI Demonstrate the use of Number to Boolean Array function to convert U32 numeric number to its binary equivalent in array form.


Description

This VI can be used to create a U32 numeric number to its binary equivalent in array form. This VI comes in handy when generating arrays on a FPGA and wanting to use the binary form as a waveform on the host VI. This VI is made to be used as a SubVI.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Download the attached folder to your computer
  2. Open the VI " U32 to Binary 2012 NIVerified.vi"
  3. Enter a number in U32 Input box
  4. Run the program

 

Additional Information or References
VI Snippet

Block Diagram.PNG

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Andrey_Dmitriev
Active Participant
Active Participant
on

Why in such complicated way? You can do the same without for loop, isn't?

02-numto10.png

Andrey.

Larry_H
Member
Member
on

Andrey,

Thank you for that alternate, and more straightforward, approach. The reason that this example was written in the form it was, was to give the programmer more flexibility when they want to fill the array with values besides 1 and 0. The user's end goal was to convert the U32 input to an array to be concatenated with other arrays to build a numeric waveform. They wanted flexibility for the 1 and 0 values. But thank you for your code, since for users who don't need that flexibility, they can use the moe straightforward approach.

Larry

Applications Engineer
National Instruments