Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding unscaled values for analog input and output

Hello,

 

We're using a PXI-4461 (24-bit ADC and DAC) and PXIe-6124 (16-bit ADC and DAC), and we're having trouble understanding the unscaled values and also the relationship between analog input and output values.

 

I wrote two VI's, one for saving long duration analog inputs and another for generating long duration analog outputs. Within the VI the user can select which DAQ module and which channel(s) to use. The analog input VI reads unscaled sample data using the "Analog 2D I32 NChan NSamp" instance of DAQmx Read. Likewise, the analog output VI writes unscaled data using the "Analog 2D I32 NChan NSamp" instance of DAQmx Write. We were hoping to use unscaled data for compatibility with other systems.

 

As we've been testing the VI's a few things have emerged related to the data format that we don't understand.

 

  1. How is the 24-bit data from the PXI-4461 packed into I32 words? We recorded what we believe should be a fullsclale signal (2 Vpp input signal with the DAQmx channel voltage range set to +/-1 V) and examined the raw data. It does not appear to use either the lowest 24 bits or highest 24 bits. Rather, it seems to use bits 7 through 30.  Is this expected?                    (Note that we also examined the PXIe-6124 raw data and it makes more sense. It appears to pack the 16-bit values into the lowest 16-bits of the I32 word.)
  2. For the PXI-4461 what is the relationship between the analog input and analog output unscaled data values? If we set the channel voltage range to +/-1 V and record an analog input, and then generate an analog output using that same raw data and voltage range, the amplitude of the analog output is always lower than the analog input. In fact, the output amplitude is consistently about 0.65x the input amplitude.  This relationship holds for other channel voltage ranges (assuming input and output are set to the same range).  Why isn't the output amplitude equal to the input amplitude?
  3. Same question as above, except for the PXIe-6124. With a +/-1 V voltage range (for both input and output), we find that the output amplitude is approximately 10x the input amplitude. However with +/-10 V voltage range (for both input and output), we find that the output amplitude is roughly the same as the input amplitude.

I'd appreciate any help I can get trying to understand all of this. Thank you.

0 Kudos
Message 1 of 3
(674 Views)

My first gut-level response is:

 

Given the troubles you're having, are you *sure* you want to work with unscaled data, now that you've seen the need to deal with some additional intricacies?

 

I don't have the exhaustive knowledge to give you a roadmap for the "right" way to do it, but *do* have awareness of possible pitfalls:

- when configuring a task and requesting a specific voltage range, you will need to follow up to *query* for the actual voltage range.  Most devices have a limited set of possible ranges to choose from.  Whatever you request (within the device's hard limits), DAQmx will select the minimum-sized range that spans both your requested min and max.   But the main point is that what you ask for isn't necessarily what you'll get.  Accurate knowledge of this range is crucial for doing your own scaling from the unscaled integer data.

- analog input and output probably don't support all the same ranges.  This likely explains why the unscaled integers you get when capturing an input voltage don't produce the same voltage when you feed them to an output task as unscaled integers.

- bit-packing and endian-ness concerns become *your* problem to solve when dealing with unscaled data as well.

 

All these difficulties are alleviated to the point of near-triviality by DAQmx if you work with the floating point scaled data instances of Read and Write.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 3
(636 Views)

Kevin,

 

Thanks for your reply.  I share your concerns about using unscaled data, and in parallel with this I'm going to add an option to the VIs to acquire / generate scaled data.  But I'd still really like to understand the issues we're seeing because it might open up the possibility of exchanging data with some other systems we use.

 

You make a good point about the voltage ranges.  I do query the actual range for the analog input channel after setting it and confirm that we're setting it to a valid value.  But I don't believe I've done that for the analog output VI so I'll definitely check that.  If +/-1 V "rounds up" to +/-10 V that would certainly explain the issue we're seeing with the PXIe-6124.

 

I do think that NI should document the unscaled data format for their devices and it shouldn't be left to the user to figure out.  Their VIs read/write that format so it should be documented and supported, even if it's not necessarily encouraged.

 

Thanks,

Mark

0 Kudos
Message 3 of 3
(623 Views)