DAQmxCreateWatchdogTimerTask

NI-DAQmx C Functions

DAQmxCreateWatchdogTimerTask

int32 DAQmxCreateWatchdogTimerTask (const char deviceName[], const char taskName[], TaskHandle *taskHandle, float64 timeout, const char channelName[], int32 expState, ...);

Purpose

Creates and configures a task that controls the watchdog timer of a device. The timer activates when you start the task.

Parameters

Input
Name Type Description
deviceName const char [] The name of the device, as configured in Measurement & Automation Explorer (MAX), to which this operation applies.
taskName const char [] The name to assign to the task. If you use this function in a loop and specify a name for the task, you must use DAQmxClearTask within the loop after you are finished with the task. Otherwise, NI-DAQmx attempts to create multiple tasks with the same name, which results in an error.
timeout float64 The time, in seconds, until the watchdog timer expires. A value of DAQmx_Val_WaitInfinitely indicates that the internal timer never expires. Use DAQmx_Val_WaitInfinitely when you use a trigger to signal an expiration of the timer. If this time elapses, the device sets the physical channels to the states you specify in expState.
Use DAQmxControlWatchdogTask with action set to DAQmx_Val_ResetTimer to prevent the watchdog timer from expiring.
channelName const char [] The digital line or port to modify. You cannot modify dedicated digital input lines. You can specify a list or range of physical channels
expState int32 The state to which to set the digital physical channel when the watchdog timer expires.
Value Description
DAQmx_Val_High High logic
DAQmx_Val_Low Low logic
DAQmx_Val_Tristate High-impedance state. You can select this state only on devices with bidirectional ports, and you can select it only for entire ports. You cannot select this state for dedicated digital output lines.
DAQmx_Val_NoChange Expiration does not affect the port. Do not change the state of any lines in the port, and do not lock the port. For example, if a line is high when the timer expires, that line stays high, and you can write new values to the line. You can select this value only for entire ports.
moreChannelsAndStates any type (passed by value) Pairs of additional channels and the states to set the channels to when the device powers up or when the device is reset. You must pass NULL at the end of the argument list.
If you do not want to pass additional channels and states, the function call can be similar to the following example:
DAQmxCreateWatchdogTimerTask ("Dev1", "myTask", *taskHandle, DAQmx_Val_WaitInfinitely, "Dev1/do0", DAQmx_Val_High, NULL);
If you pass additional channels and states, the function call can be similar to the following example:
DAQmxCreateWatchdogTimerTask ("Dev1", "myTask", *taskHandle, DAQmx_Val_WaitInfinitely, "Dev1/do0", DAQmx_Val_High, "Dev1/do1", DAQmx_Val_Tristate, NULL);
Output
taskHandle TaskHandle * A reference to the new task.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.