Scope
DAQmx Namespace Reference

Classes

class  CDAQmxAnalogInTask
 
class  CDAQmxAnalogOutTask
 
class  CDAQmxCounterOutTask
 
class  CDAQmxDigitalOutTask
 
class  CDAQmxTask
 

Functions

bool CheckError (const int32 &error)
 
double PredictSampleRate (const double &_desiredrate, const uint32_t &_nochannels, const double &_refclockrate, const int32 &_mode)
 
double CoerceSampleRates (const double &_desiredrate, const uint32_t &_nochannelsin, const uint32_t &_nochannelsout, const double &_refclockrate)
 
std::wstring ClockString (const scope::DaqTimingHelper::Mode &_timing, const std::wstring &_externalclocksource)
 

Detailed Description

This is basically a C++ wrapper around NI's DAQmx C library.

Contains all DAQmx related stuff.

Function Documentation

bool DAQmx::CheckError ( const int32 &  error)

Checks return value of NI DAQmx function for error, prints out error information and throws an exception if DAQMX_THROW_EXCEPTION is defined true.

Returns
returns true if an error occured, false if no error

Definition at line 9 of file DAQmxTask.cpp.

double DAQmx::PredictSampleRate ( const double &  _desiredrate,
const uint32_t &  _nochannels,
const double &  _refclockrate,
const int32 &  _mode 
)

Predicts the actual sampling rate.

The real sample rate for analog in and out operations can differ slightly. Read NI Knowledge Base "How Is the Actual Scan Rate Determined When I Specify the Scan Rate for My Data Acquisition?".
see here: http://digital.ni.com/public.nsf/websearch/5782F1B396474BAF86256A1D00572D6E?OpenDocument
and here: http://digital.ni.com/public.nsf/allkb/4BBE1409700F6CE686256E9200652F6B?OpenDocument
for details of the calculations.
Note that the result of this function does not take into account the maximum sample rate of your device, this can only be looked up in the devices data sheet!!!! For NI-6259: 32 bit AI and AO clocks.

Parameters
[in]_desiredratedesired sample rate
[in]_nochannelsnumber of channels
[in]_refclockraterate of the reference clock
[in]_modeModes for PredictSampleRate (defined in NIDAQmx.h)
  • DAQmx_Val_AI 10100 // Analog Input
  • DAQmx_Val_AO 10102 // Analog Output
Returns
the actual sampling rate the device will use

Definition at line 23 of file DAQmxTask.cpp.

double DAQmx::CoerceSampleRates ( const double &  _desiredrate,
const uint32_t &  _nochannelsin,
const uint32_t &  _nochannelsout,
const double &  _refclockrate 
)

Calculates a sampling rate which both analog in and out can comply to.

see here: http://digital.ni.com/public.nsf/websearch/5782F1B396474BAF86256A1D00572D6E?OpenDocument
for an explanation why both rates could be different.
Note that the result of this function does not take into account the maximum sample rate of your device, this can only be looked up in the devices data sheet!!!!

Parameters
[in]_desiredratedesired sampling rate (in Hz)
[in]_nochannelsinthe number of channels in the input task
[in]_nochannelsoutthe number of channels in the output task
[in]_refclockratefrequency of the reference clock (in Hz)
Returns
the sampling rate (in Hz) which both input and output can have simultaneously

Definition at line 37 of file DAQmxTask.cpp.

std::wstring DAQmx::ClockString ( const scope::DaqTimingHelper::Mode _timing,
const std::wstring &  _externalclocksource 
)

Generates a string for the sample clock from daq_timing.

Parameters
_timingchoosen timing mode (onboard, reference clock, external clock)
_externalclocksourcesource of an external sample clock
Returns
a string with the correct clock stuff you can provide to ConfigureSampleTiming

Definition at line 46 of file DAQmxTask.cpp.