Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I keep track of all samples acquired?

Hi,
 
I am using PCI-6259. I am porting a NI-DAQ C++ application to NI-DAQMX. Previously my code was using function DAQ_Check to get the latest sample number so I could keep track of all samples acquired. The process was running in the bacground constantly filling up the buffer area that I supplied ( global variable shared between NI-DAQ and my process ). Right now it looks like I have to call DAQmxReadAnalogF64 function explicitly. Is that the case? Are there any C/C++ examples available to illustrate that?

Thanks,

Jerry.

0 Kudos
Message 1 of 6
(3,696 Views)

Hi Jerry-

The analogous function in NI-DAQmx is "DAQmxGetReadAvailSampPerChan."  This function is defined in the NI-DAQmx C Reference Help ( Start>>Programs>>National Instruments>>NI-DAQ ) as:

 

Get/Set/Reset Read_AvailSampPerChan

int32 __CFUNC DAQmxGetReadAvailSampPerChan(TaskHandle taskHandle, uInt32 *data);


Purpose

DAQmxGetReadAvailSampPerChan gets the Status >> Available Samples Per Channel property.

 

This function will return the available samples per channel currently buffered for each channel in the task.  This single number will be the same for each channel and will return as a uInt32 datatype.

If you would like to use the DAQmxReadAnalogF64 function by itself in a continuous acqusition you can specify a "-1" for the numSampsPerChan parameter to return all samples that are currently available.  The behavior with this setting is slightly different for finite acquisitions and is explained in more detail in the NI-DAQmx C Reference Help documentation for the DAQmxReadAnalogF64 function. 

Hopefully this helps-

Message Edited by Tom W. on 08-03-2005 03:41 PM

Message Edited by Tom W. on 08-03-2005 03:41 PM

Tom W
National Instruments
0 Kudos
Message 2 of 6
(3,680 Views)

Thanks Tom. I found it myself. Too bad there are no C++/C examples available ( at least I could not find any ).

Jerry.

0 Kudos
Message 3 of 6
(3,672 Views)

Hi Jerry-

I forgot to mention that ANSI C examples are in fact installed with the driver at "C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C" on your local drive.

Thanks-

Tom W
National Instruments
0 Kudos
Message 4 of 6
(3,670 Views)
Are there any that deal with circular buffer acquisition, show how to change attributes and explore different possible aspects?
 
Thanks,
Jerry.
0 Kudos
Message 5 of 6
(3,668 Views)
Hi Jerry-
 
All continuous acquire examples automatically use circular buffering of data- it's not something that needs to be enabled.  Any acquisition that is hardware-timed (i.e. controlled by a hardware sample clock) that calls the DAQmx read functions multiple times in a loop will automatically use circular buffering techniques.  In fact, circular buffering will be used unless you perform single point software-timed acquisitions or finite buffered acquisitions where you only call the NI-DAQmx read function a single time
 
There aren't really a lot of examples available that show how to change various properties because these types of settings are in general very appliation-specific.  The best resource that I use to find information about properties and functions for NI-DAQmx is the NI-DAQmx C Reference I mentioned before under the NI-DAQmx C Properties section.  The properties are categorized very nicely into appropriate sections and each property is shown with a brief description and its C Function prototype.
 
If you have a specific question about a property feel free to post back and we can go into more detail.
 
Thanks-
Tom W
National Instruments
0 Kudos
Message 6 of 6
(3,650 Views)