Data Acquisition Toolbox | ![]() ![]() |
Event Types
The analog output event types and associated callback properties are described below.
Event Type |
Property Name |
Run-time error |
RuntimeErrorFcn |
Samples output | SamplesOutputFcn |
SamplesOutputFcnCount |
|
Start |
StartFcn |
Stop |
StopFcn |
Timer | TimerFcn |
TimerPeriod |
|
Trigger |
TriggerFcn |
Run-time Error Event. A run-time error event is generated immediately after a run-time error occurs. This event executes the callback function specified for RuntimeErrorFcn
. Additionally, a toolbox error message is automatically displayed to the MATLAB workspace. If an error occurs that is not explicitly handled by the toolbox, then the hardware-specific error message is displayed.
The default value for RunTimeErrorFcn
is daqcallback
, which displays the event type, the time the event occurred, the device object name, and the error message.
Run-time errors include hardware errors and timeouts. Run-time errors do not include configuration errors such as setting an invalid property value.
Samples Output Event. A samples output event is generated immediately after the number of samples specified by the SamplesOutputFcnCount
property is output for each channel group member. This event executes the callback function specified for SamplesOutputFcn
.
Start Event. A start event is generated immediately after the start
function is issued. This event executes the callback function specified for StartFcn
. When the callback function has finished executing, Running
is automatically set to On
and the device object and hardware device begin executing. The device object is not started if an error occurs while executing the callback function.
Stop Event. A stop event is generated immediately after the device object and hardware device stop running. This occurs when
stop
function is issued.
A stop event executes the callback function specified for StopFcn
. Under most circumstances, the callback function is not guaranteed to complete execution until sometime after the device object and hardware device stop running, and the Running
property is set to Off
.
Timer Event. A timer event is generated whenever the time specified by the TimerPeriod
property passes. This event executes the callback function specified for TimerFcn
. Time is measured relative to when the device object starts running.
Some timer events might not be processed if your system is significantly slowed or if the TimerPeriod
value is too small. For example, a common application for timer events is to display data. However, because displaying data is a CPU-intensive task, some of these events might be dropped. To guarantee that events are not dropped, you can use the SamplesOutputFcn
property.
Trigger Event. A trigger event is generated immediately after a trigger occurs. This event executes the callback function specified for TriggerFcn
. Under most circumstances, the callback function is not guaranteed to complete execution until sometime after Sending
is set to On
.
![]() | Events and Callbacks | Recording and Retrieving Event Information | ![]() |