11-16-2022 12:56 PM
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.
I'd appreciate any help I can get trying to understand all of this. Thank you.
11-17-2022 11:39 AM
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.
11-17-2022 03:45 PM
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.