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 Gray Code to Binary

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 NXG

Code and Documents

Attachment

Overview

Converts a gray code into a binary number.

Description

Converts a binary number in Gray code to a standard binary representation. Gray-coded binary is used widely with absolute encoders in industry due to the property that each transition involves only a single bit change, ensuring that there are no indeterminate states.

Hardware and Software Requirements

LabVIEW NXG 1.0 or compatible

Steps to Implement or Execute Code

1. Input a Gray code in the panel.
2. Run the VI to conver the Gray code to a binary number.

Additional Information or References

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