Example Code

Extracting Error Information from Status Bytes Sent from an External Instrument.

Code and Documents

Attachment

Download All

Overview
This example VI shows how to extracting error information from status bytes sent from an external instrument.


Description
External equipment will often send information about the device status or errors as a byte or multiple bytes of information, where each bit represents a unique piece of information about the device. The bit convention for error or no error state can often differ even within the same status byte or word. This example shows how we can isolate the error information from general staus information. So the first step is to invert the logic of any bits that have an error represented by a 0. (XOR with "inverted" bitmask). The second step is to remove the none error status bits. (AND with "error" bitmask). This will leave us with a binary value with 1s wherever an error exists.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Open the VI "Bitwise Error 2012 NIVerified.vi"
  3. Write the corresponding control value
  4. Run the program

 

Additional Information or References
VI Snippet

 

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

Stephen C
Applications Engineer

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