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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting to Voltage for the NI-5751 IO Module

Solved!
Go to solution

The only place I can see an example of this is in the "NI 5751 Finite Acquisition Multiple Channels" example.  The conversion in the VI is shown below:

Capture.JPG

 

This is a 14-bit digitizer, so I don't understand the "16" for the resolution.

 

The text in the example says, "The data from the 14-bit ADCs are represented in the CLIP as a 2's compliment, MSB justified, I16. The 2 LSBs are padded with zeros. The data is multiplied by a scaling factor (ADC voltage resolution = voltage range / ADC intervals * 16) to LSB justify the data and scale to volts." This seems to be different than the above code.

 

I don't understand what the factor of 16 is from the text. Nor do I understand how these are the same.

0 Kudos
Message 1 of 6
(2,783 Views)

Hello JP82,

 

This scaling method manually unpacks the I16 values being brought in from the ADC using Split Number nodes.  
There are several stages of unpacking because the array itself is initialized as a U64.  If we were to use a scaling factor of 14 when we're splitting a power-of-two integer over and over again, the values would lose coherency quickly.  

The Shipping Examples for the 5751 are the only ones that use this method for handling data from a 14-bit ADC.  The shipping examples for the other 14-bit modules use a less obtrusive subVI for scaling the incoming data LVFPGA Scale Data.

 

I've attached a small piece of code that (to a very limited extent) demonstrates how the two different methods produce very similar values.

 

Best regards

Matthew H.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(2,747 Views)
Solution
Accepted by topic author jp82

Hey JP82, 

The 5751 is one of our FAMs that produces MSB justified data, with the two left most (LSB) containing 0.  

If you shifted the data generetaed by the fam to the right by two, then you would use the 14 bit resolution. 

 

Example MSB Justified:  

Input Voltage : 1V
Binary Representation from FAM:  0111111111111100

                                       Sign Bit^       Zero LSB's^ ^    

Decimal Rep: 32764

MATH:

2/(2^16 - 1) * 32764 = 

3.05E-5 * 32764 = 0.999302 ~ 1V

 

If it was LSB justified:

Input Voltage : 1V
Binary Representation from FAM:  0001111111111111

                                       Sign Bit^           

Decimal Rep: 8191

MATH:

2/(2^14 - 1) * 8191 = 

1.22E-4 * 8191 = 0.99993 ~ 1V

 

I don't believe that the data is two's complimented, as the details indicate.  I will see to it that that gets fixed. 

National Instruments
FlexRIO & R-Series Product Support Engineer
0 Kudos
Message 3 of 6
(2,732 Views)

Correction, when I said " two left most (LSB)", I meant "two Right most (LSB)". 

I got carried away with the letter L!

National Instruments
FlexRIO & R-Series Product Support Engineer
0 Kudos
Message 4 of 6
(2,716 Views)

Also, it is 2's complement.  If the smallest number that can be represented is 00000000000000, then to two's complement that, you first 1's complement (flip everything) and add 1. 

100000000000000, which is the most negative number as an I16

 

2013-03-12_130302.png

 

National Instruments
FlexRIO & R-Series Product Support Engineer
0 Kudos
Message 5 of 6
(2,710 Views)

That explanation makes this much, much clearer. Thanks! It would be great to see those details in the documentation for the card or in the example.

 

Sorry for not replying sooner, I was out of the office last week.

 

 

0 Kudos
Message 6 of 6
(2,688 Views)