Scope
DAQmx::CDAQmxTask Class Reference

#include <DAQmxTask.h>

Inherited by DAQmx::CDAQmxAnalogInTask, DAQmx::CDAQmxAnalogOutTask, DAQmx::CDAQmxCounterOutTask, and DAQmx::CDAQmxDigitalOutTask.

Public Member Functions

 ~CDAQmxTask (void)
 
void CreateTask (const std::wstring &_name=L"")
 
bool Created () const
 
void ConfigureImplicitTiming (const int32 &_mode, const int32 &_samplesperchan)
 
void ConfigureSampleTiming (const std::wstring &_src, const float64 &_rate, const int32 &_samplesperchan, const int32 &_samplingtype=DAQmx_Val_ContSamps, const int32 &_actedge=DAQmx_Val_Rising)
 
void ConfigureReferenceClock (const std::wstring &_src, const float64 &_rate)
 
void ConfigureDigStartTrigger (const std::wstring &_src, const int32 &_trigedge=DAQmx_Val_Rising)
 
void Start (void)
 
void Stop (void)
 
void Clear (void)
 
bool IsTaskDone (void)
 
int32_t WaitUntilDone (const float64 &_waittime)
 
void ExportSignal (int32 _signal, const std::wstring &_terminal)
 
void SetWriteOffset (int32 posreltofirst)
 
void SetRegeneration (const bool &_regenerate)
 

Protected Attributes

TaskHandle task_handle
 

Detailed Description

Base class for DAQmx tasks.

Definition at line 54 of file DAQmxTask.h.

Constructor & Destructor Documentation

DAQmx::CDAQmxTask::~CDAQmxTask ( void  )

Clear the task.

Definition at line 86 of file DAQmxTask.cpp.

Member Function Documentation

void DAQmx::CDAQmxTask::CreateTask ( const std::wstring &  _name = L"")
Parameters
[in]_namename of the task, leave empty

Definition at line 91 of file DAQmxTask.cpp.

bool DAQmx::CDAQmxTask::Created ( ) const
Returns
task already created?

Definition at line 96 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::ConfigureImplicitTiming ( const int32 &  _mode,
const int32 &  _samplesperchan 
)

Configures implicit timing for the task.

Parameters
[in]_modeTiming mode, possible values (from NIDAQmx.h) are DAQmx_Val_FiniteSamps or DAQmx_Val_ContSamps
[in]_samplesperchanhow many samples per channel are expected

Definition at line 100 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::ConfigureSampleTiming ( const std::wstring &  _src,
const float64 &  _rate,
const int32 &  _samplesperchan,
const int32 &  _samplingtype = DAQmx_Val_ContSamps,
const int32 &  _actedge = DAQmx_Val_Rising 
)

Configures a sample timing for the task.

Parameters
[in]_srcSource terminal of the sample clock, or L"" for onboard PPL (locked to a reference clock) or L"OnboardClock" for onboard derived clock generation
[in]_rateDesired sample rate
[in]_samplesperchanEstimated samples per channels, defines buffer size
[in]_samplingtypeCan be either DAQmx_Val_FiniteSamps or DAQmx_Val_ContSamps
[in]_actedgeActive edge of sample clock, can be either DAQmx_Val_Rising or DAQmx_Val_Falling

Definition at line 109 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::ConfigureReferenceClock ( const std::wstring &  _src,
const float64 &  _rate 
)

Configures the reference clock for the task.

Parameters
[in]_srcsource terminal of the reference clock
[in]_raterate of the reference clock (has to be known!)

Definition at line 128 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::ConfigureDigStartTrigger ( const std::wstring &  _src,
const int32 &  _trigedge = DAQmx_Val_Rising 
)

Configures the start trigger.

Parameters
[in]_srcterminal the start trigger is connected to
[in]_trigedgeeither DAQmx_Val_Rising or DAQmx_Val_Falling

Definition at line 134 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::Start ( void  )

Starts the task.

Definition at line 145 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::Stop ( void  )

Stops the task.

Definition at line 149 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::Clear ( void  )

Clear the task.

Definition at line 153 of file DAQmxTask.cpp.

bool DAQmx::CDAQmxTask::IsTaskDone ( void  )
Returns
is the task already done?

Definition at line 157 of file DAQmxTask.cpp.

int32_t DAQmx::CDAQmxTask::WaitUntilDone ( const float64 &  _waittime)

Waits until the task is done.

Parameters
[in]_waittimewait maximally _waittime
Returns
0 if task done, a positive value is a warning, a negative value an error

Definition at line 163 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::ExportSignal ( int32  _signal,
const std::wstring &  _terminal 
)

Exports a signal to an output terminal.

Parameters
[in]_signalAllowed signal are (from NiDAQmx.h):
  • DAQmx_Val_AIConvertClock 12484 // AI Convert Clock
  • DAQmx_Val_10MHzRefClock 12536 // 10MHz Reference Clock
  • DAQmx_Val_20MHzTimebaseClock 12486 // 20MHz Timebase Clock
  • DAQmx_Val_SampleClock 12487 // Sample Clock
  • DAQmx_Val_AdvanceTrigger 12488 // Advance Trigger
  • DAQmx_Val_ReferenceTrigger 12490 // Reference Trigger
  • DAQmx_Val_StartTrigger 12491 // Start Trigger
  • DAQmx_Val_AdvCmpltEvent 12492 // Advance Complete Event
  • DAQmx_Val_AIHoldCmpltEvent 12493 // AI Hold Complete Event
  • DAQmx_Val_CounterOutputEvent 12494 // Counter Output Event
  • DAQmx_Val_ChangeDetectionEvent 12511 // Change Detection Event
  • DAQmx_Val_WDTExpiredEvent 12512 // Watchdog Timer Expired Event
[in]_terminalthe device terminal to export to

Definition at line 167 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::SetWriteOffset ( int32  posreltofirst)

Sets the write offset relative to the first buffer position.

Definition at line 172 of file DAQmxTask.cpp.

void DAQmx::CDAQmxTask::SetRegeneration ( const bool &  _regenerate)

Sets the mode of sample regeneration.

Definition at line 177 of file DAQmxTask.cpp.

Member Data Documentation

TaskHandle DAQmx::CDAQmxTask::task_handle
protected

the DAQmx task handle

Definition at line 58 of file DAQmxTask.h.


The documentation for this class was generated from the following files: