Scope
DAQmx::CDAQmxAnalogOutTask Class Reference

#include <DAQmxTask.h>

Inherits DAQmx::CDAQmxTask.

Public Member Functions

void CreateAOVoltageChannel (const std::wstring &_devices, const std::wstring &_channelname=L"", float64 _minval=-10.0, float64 _maxval=10.0, int32 _units=DAQmx_Val_Volts, const std::wstring &_customscalename=L"")
 
uInt32 ConfigureBuffer (const uInt32 &_sampsperchannel)
 
uInt32 ConfigureOnboardBuffer (const uInt32 &_sampsperchannel)
 
void UseOnlyOnboardMemory (const std::wstring &_channel)
 
void SetIdleOutputBehaviour (const std::wstring &_channel, const int32_t &_behav)
 
void SetDataTransferCondition (const std::wstring &_channel, const int32_t &_cond)
 
void SetDataTransferMode (const std::wstring &_channel, const int32_t &_mode)
 
int32 WriteAnalog (const float64 *_data, int32 _sampsperchan, bool _autostart=false, int32 _timeout=2, bool32 _layout=DAQmx_Val_GroupByChannel)
 
void WriteAnalogScalar (const float64 &_value, bool _autostart=false, int32 _timeout=1000)
 
int32 WriteAnalogI16 (const int16 *_data, int32 _sampsperchan, bool _autostart=false, int32 _timeout=2, bool32 _layout=DAQmx_Val_GroupByChannel)
 
- Public Member Functions inherited from DAQmx::CDAQmxTask
 ~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)
 

Additional Inherited Members

- Protected Attributes inherited from DAQmx::CDAQmxTask
TaskHandle task_handle
 

Detailed Description

Wraps a DAQmx Analog Output task.

Definition at line 137 of file DAQmxTask.h.

Member Function Documentation

void DAQmx::CDAQmxAnalogOutTask::CreateAOVoltageChannel ( const std::wstring &  _devices,
const std::wstring &  _channelname = L"",
float64  _minval = -10.0,
float64  _maxval = 10.0,
int32  _units = DAQmx_Val_Volts,
const std::wstring &  _customscalename = L"" 
)

Creates an analog output channel Allowed values for terminal configuration (from NiDAQmx.h):
Values for DAQmx_PhysicalChan_AI_TermCfgs and DAQmx_PhysicalChan_AO_TermCfgs
Value set TerminalConfigurationBits
.

  • DAQmx_Val_Bit_TermCfg_RSE (1<<0) // RSE terminal configuration
  • DAQmx_Val_Bit_TermCfg_NRSE (1<<1) // NRSE terminal configuration
  • DAQmx_Val_Bit_TermCfg_Diff (1<<2) // Differential terminal configuration
  • DAQmx_Val_Bit_TermCfg_PseudoDIFF (1<<3) // Pseudodifferential terminal configuration

Definition at line 182 of file DAQmxTask.cpp.

uInt32 DAQmx::CDAQmxAnalogOutTask::ConfigureBuffer ( const uInt32 &  _sampsperchannel)

Configure the daqmx output buffer on the PC.

Parameters
[in]_sampsperchannelbuffer size is _sampsperchannel times number of channels
Returns
the actual buffer size

Definition at line 201 of file DAQmxTask.cpp.

uInt32 DAQmx::CDAQmxAnalogOutTask::ConfigureOnboardBuffer ( const uInt32 &  _sampsperchannel)

Configure the output buffer on the device hardware.

Parameters
[in]_sampsperchannelbuffer size is _sampsperchannel times number of channels
Returns
the actual buffer size

Definition at line 211 of file DAQmxTask.cpp.

void DAQmx::CDAQmxAnalogOutTask::UseOnlyOnboardMemory ( const std::wstring &  _channel)

Configures the task to use only the devices' onboard memory.

Write operations do not use a DAQmx buffer on the PC but write directly to onboard memory.

Warning
You cannot write to the device after the start was started. This is only possible with DAQmx buffer on the PC.
Parameters
[in]_channelThe channel(s) for which this is configured

Definition at line 219 of file DAQmxTask.cpp.

void DAQmx::CDAQmxAnalogOutTask::SetIdleOutputBehaviour ( const std::wstring &  _channel,
const int32_t &  _behav 
)

Configures the output behaviour when the task is not running.

Parameters
[in]_channelthe channel(s) for which this is configured
[in]_behavthe desired behaviour
  • DAQmx_Val_ZeroVolts output 0V continuously
  • DAQmx_Val_HighImpedance set output to a high-impedance state, effectively disconnecting output circuitry from IO connector
  • DAQmx_Val_MaintainExistingValue output the last generated sample continously

Definition at line 224 of file DAQmxTask.cpp.

void DAQmx::CDAQmxAnalogOutTask::SetDataTransferCondition ( const std::wstring &  _channel,
const int32_t &  _cond 
)

Configures the condition for data transfer to the device.

Parameters
[in]_channelthe channel(s) for which this is configured
[in]_condthe transfer condition
  • DAQmx_Val_OnBrdMemEmpty Transfer data to the device only when there is no data in the onboard memory of the device.
  • DAQmx_Val_OnBrdMemHalfFullOrLess Transfer data to the device any time the onboard memory is less than half full.
  • DAQmx_Val_OnBrdMemNotFull Transfer data to the device any time the onboard memory of the device is not full.

Definition at line 229 of file DAQmxTask.cpp.

void DAQmx::CDAQmxAnalogOutTask::SetDataTransferMode ( const std::wstring &  _channel,
const int32_t &  _mode 
)

Configures the mode of data transfer between the daqmx buffer on the PC and the onboard buffer of the device.

Parameters
[in]_channelthe channel(s) for which this is configured
[in]_modethe transfer mode
  • DAQmx_Val_DMA Direct Memory Access. Data transfers take place independently from the application.
  • DAQmx_Val_Interrupts Data transfers take place independently from the application. Using interrupts increases CPU usage because the CPU must service interrupt requests. Typically, you should use interrupts if the device is out of DMA channels.
  • DAQmx_Val_ProgrammedIO Data transfers take place when you call an NI-DAQmx Read function or an NI-DAQmx Write function.
  • DAQmx_Val_USBbulk Data transfers take place independently from the application using a USB bulk pipe.

Definition at line 234 of file DAQmxTask.cpp.

int32 DAQmx::CDAQmxAnalogOutTask::WriteAnalog ( const float64 *  _data,
int32  _sampsperchan,
bool  _autostart = false,
int32  _timeout = 2,
bool32  _layout = DAQmx_Val_GroupByChannel 
)

Writes several samples to the buffer of an analog output task.

_data array should be grouped by channel and contain at least _sampsperchan times number of channels values.

Parameters
[in]_datapointer to a float64 array, whose values should fall into the configured output range of the task.
[in]_sampsperchannumber of samples per channel to be written.
[in]_autostarttrue if task should be automatically started after write to buffer
[in]_timeouthow long to wait for the write to the buffer to happen, in seconds
[in]_layoutdata layout to use
  • DAQmx_Val_GroupByChannel by channel (AAAAABBBBBCCCCC)
  • DAQmx_Val_GroupByScanNumber by sample (ABCABCABCABCABC)

Definition at line 239 of file DAQmxTask.cpp.

void DAQmx::CDAQmxAnalogOutTask::WriteAnalogScalar ( const float64 &  _value,
bool  _autostart = false,
int32  _timeout = 1000 
)

Writes a single sample to the buffer of an analog output task.

Parameters
[in]_valueshould fall into the configured output range of the task
[in]_autostarttrue if task should be automatically started after write to buffer
[in]_timeouthow long to wait for the write to the buffer to happen, in seconds

Definition at line 251 of file DAQmxTask.cpp.

int32 DAQmx::CDAQmxAnalogOutTask::WriteAnalogI16 ( const int16 *  _data,
int32  _sampsperchan,
bool  _autostart = false,
int32  _timeout = 2,
bool32  _layout = DAQmx_Val_GroupByChannel 
)

Writes several samples to the buffer of an analog output task.

_data array should be grouped by channel and contain at least _sampsperchan times number of channels values.

Parameters
[in]_datapointer to a int16 array, whose values cover the configured output range of the task.
[in]_sampsperchannumber of samples per channel to be written.
[in]_autostarttrue if task should be automatically started after write to buffer
[in]_timeouthow long to wait for the write to the buffer to happen, in seconds
[in]_layoutdata layout to use
  • DAQmx_Val_GroupByChannel by channel (AAAAABBBBBCCCCC)
  • DAQmx_Val_GroupByScanNumber by sample (ABCABCABCABCABC)

Definition at line 258 of file DAQmxTask.cpp.


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