Example Code

Integer to Binary Coded Decimal using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview
This VI converts an U32 to Binary Coded Decimal. Each digit can take up to 4 bits, so two digits can fit in to a single U8. This can be optionally toggled 


Description
This VI converts an U32 to Binary Coded Decimal. Each digit can take up to 4 bits, so two digits can fit in to a single U8. This can be optionally toggled


Requirements

Software:

  1. LabVIEW 2015(or compatible)


Steps to Implement or Execute Code

  1. Open the VI
  2. Input a number
  3. Observe that the output matches

 

Additional Information or References
VI Block Diagram

1.png

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

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments

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

Comments
ecande
Member
Member
on

Can you please downconvert to earlier LabVIEW version? I have 2014, but the community may benefit more with a 2009 version.

tsplinter0
Member
Member
on

Very nice algorithm, it is well documented and simple.

However I think the input should be unsigned. It seems to go into an infinite loop when the input is negative.

An easy fix, thanks for the code..

Tanner!
NI Employee (retired)
on

Good catch. I'll change the example and re-upload.

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments