Data Acquisition Toolbox | ![]() ![]() |
Event Types
The analog input event types and associated callback properties are described below.
Event Type |
Property Name |
Data missed |
DataMissedFcn |
Input overrange |
InputOverRangeFcn |
Run-time error |
RuntimeErrorFcn |
Samples acquired | SamplesAcquiredFcn |
SamplesAcquiredFcnCount |
|
Start |
StartFcn |
Stop |
StopFcn |
Timer | TimerFcn |
TimerPeriod |
|
Trigger |
TriggerFcn |
Data Missed Event. A data missed event is generated immediately after acquired data is missed. In most cases, data is missed because
BufferingConfig
property.
This event executes the callback function specified for the DataMissedFcn
property. The default value for DataMissedFcn
is daqcallback
, which displays the event type and the device object name. When a data missed event occurs, the analog input object is automatically stopped.
Input Overrange Event. An input overrange event is generated immediately after an overrange condition is detected for any channel group member. An overrange condition occurs when an input signal exceeds the range specified by the InputRange
property.
This event executes the callback function specified for the InputOverRangeFcn
property. Overrange detection is enabled only when a callback function is specified for InputOverRangeFcn
, and the analog input object is running.
Run-time Error Event. A run-time error event is generated immediately after a run-time error occurs. 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.
This event executes the callback function specified for RuntimeErrorFcn
. 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 Acquired Event. A samples acquired event is generated immediately after a predetermined number of samples is acquired.
This event executes the callback function specified for the SamplesAcquiredFcn
property every time the number of samples specified by SamplesAcquiredFcnCount
is acquired for each channel group member.
You should use SamplesAcquiredFcn
if you must access each sample that is acquired. However, if you are performing a CPU-intensive task with the data, then system performance might be adversely affected. If you do not have this requirement, you might want to use the TimerFcn
property.
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 StartFcn
M-file 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, use the SamplesAcquiredFcn
property.
Trigger Event. A trigger event is generated immediately after a trigger occurs. This event executes the callback function specified for the TriggerFcn
property. Under most circumstances, the callback function is not guaranteed to complete execution until sometime after Logging
is set to On
.
![]() | Events and Callbacks | Recording and Retrieving Event Information | ![]() |