Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

NI4474/CVI reading 24 bit values into 32 bit Variables

I´m reading 24-bit values from a NI4474 using the SCAN-function of LabWindows/CVI. Since this function expects a data buffer of 16-bit values, I type cast an integer array (32 bit) to short (16 bit). After execution of this function I would expect

1. to find the 24-bit A/D-values in the 24 MSB´s of the 32-bit array members, and find the remaining 8 LSB´s all zero (i.e. unchanged),

2. the values in the interer array to be multiple integers of 256 (2^8),

3. to receive a reading of 7FFF FF00 (hex) = 2 147 483 392 (decimal) when (intentionally) applying a voltage greater +10V,

4. to receive a reading of 8000 0000 (hex) = -2 147 483 648 (decimal) when (intentionally) applying a voltage less then -10V.

All this does not happen. The values in the integer array reach even as well as odd numbers. The span of the values is approximately between -1 150 000 000 and + 1 135 000 000. I say approximately because it changes each time I calibrate the board with the function Calibrate_DSA. Does anybody have an explanation or know, what my error in reasoning is?
0 Kudos
Message 1 of 6
(7,603 Views)
I would recommend that you try using the DAQmx API with NI-4474. Reading binary values is much easier with DAQmx... you should use the following function call:

DAQmxReadBinaryI32 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, int32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

To get started with DAQmx, check out some of the shipping examples in the CVI example directory. In order to use DAQmx with the NI-4474, you must have at least NI-DAQ 7.1.

Also, I'm curious why you are interested in the binary reads from the board. What kind of measurements are you making?

-Jack
Message 2 of 6
(7,550 Views)
Jack, thanks for your hint. I can´t install NI-DAQ 7.1 because it doesn´t work with CVI 5.5, which I´m still using. The reason why I´m interested in the binary readings has nothing to do with the measurements - sound measurements. It´s just that I´m using an NI4474 for the first time (AT-A2150 so far) and I´m checking it out, want to understand it´s behaviour.
0 Kudos
Message 3 of 6
(7,545 Views)
Hi,you´ve written that you are using CVI 5.5. What about NI-DAQ version and NI-DSA version?
When installing NI-DSA than you will find special functions for this hardware! Else in NI-DAQ there is a function which is called AI_VRead_Scan. This will give you a double value.
You can download the drivers on the following page: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C11E4?opendocument&node=132070_US. Additional there is a special homepage only for DSA: http://www.ni.com/support/dsa/. Perhaps in future it will be helpful.
National Instruments Germany
0 Kudos
Message 4 of 6
(7,539 Views)
Thank you Rebecca for your comment. The installed NI-DAQ Version is 6.9.3f3. This is the latest version which works with CVI 5.5. I have not installed NI-DSA because in the product description it says "This driver allows you to use the DSP on the NI-4551 and NI-4552 devices." - I think I don´t need this for my NI-4474, which has no DSP.
The function AI_VRead_Scan is not on the list of NI-DAQ-functions for the NI-4474. In the NI-DAQ Help it says "This function works on E Series devices only". Also, this fuction initiates only a single A/D-conversion in contrast to the SCAN_Start function which delivers a set of equidistantly sampled data - and that´s what I need.
I notice that you and Jack (reply #1) are trying to find a workaround for the problem I described rather than solving it, or telling me what my error is. I am afraid that my question so unprecise or irrelevant or simply weird that it cannot be answered. Is that so?
0 Kudos
Message 5 of 6
(7,532 Views)
Hopefully this reply will clear some things up.

Typically the binary values are not very useful in most applications and is why I was asking if you need to use them. It sounds like you don't. I would recommend starting with a different example which returns scaled data. We have a handful of these on our website. Here are links to a couple:

Multi-Channel Finite Acquisition:
http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B4C4310D92C76038E034080020E74861&p_node=DZ52265&p_submitted=N&p_rank=&p_answer=&p_source=External

Single Channel Continuous Acquisition:
http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B4C3890434A6654EE034080020E74861&p_node=DZ52265&p_submitted=N&p_rank=&p_answer=&p_source=External

These are two great places to start.

Regarding some of your earlier binary questions, the binary values returned by the board are not padded with zeroes. The values beyond 24 bits are the results of onboard mathematical processing. These are not significant bits.

Also, check out this KB about for the answer to the question concerning the max binary value:
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/0441cc9e6bf2a31d86256d96006f2715?OpenDocument

Hope this helps and I would recommend diving into the scaled examples since that is most likely what you actually be using in your application.

-Jack
0 Kudos
Message 6 of 6
(7,503 Views)