Why am I Getting Large Binary Values From Analog FPGA Reading?

Updated Apr 2, 2018

Reported In

Hardware

  • CompactRIO Chassis

Software

  • LabVIEW FPGA Module

Driver

  • NI-RIO

Issue Details

  • I am getting data from the analog input of one of my devices on the FPGA and the RAW value that is coming out is a very large number that is close to 5 million. Why is this happening and how do I fix it?
  •  I am seeing raw binary data that is outside of the range of my analog device in my FPGA code. Why is this happening?

Solution

It is possible to see raw binary data (for example, 4.29E+9 coming) from a 24 bit analog module or values that seem very high compared to expected values. These values can occur if the value being read from the module is negative. The FPGA I/O node output for an analog reading is an I32. If this I32 value is passed from a module I/O read node to a function such as a DMA Write function and then read on a host VI, the resulting output will be a U32, and an unexpectedly large number will be read. This is normally corrected by the Binary to Nominal VI found in many cRIO examples. However, you can also use the To Long Integer function to correct this problem.

 
If you have installed the NI-RIO 2.4 driver or later, you should consider using the fixed-point datatype which embeds the calibration data within the data type and does not require the above mentioned conversions.

Additional Information

More information on why this is happening  and how to fix it can be found in this document about Converting and Calibrating CompactRIO Analog Input Values

WAS THIS ARTICLE HELPFUL?

Not Helpful