User`s manual
8 Serial Port I/O
8-50
buffer. If BytesAvailableFcnMode is terminator, then the callback function
executes every time the character specified by the
Terminator property is read.
This event can be generated only during an asynchronous read operation.
Error Event. An error event is generated immediately after an error occurs.
This event executes the callback function specified for the
ErrorFcn property.
It can be generated only during an asynchronous read or write operation.
An error event is generated when a timeout occurs. A timeout occurs if a read
or write operation does not successfully complete within the time specified by
the
Timeout property. An error event is not generated for configuration errors
such as setting an invalid property value.
Output-Empty Event. An output-empty event is generated immediately after the
output buffer is empty.
This event executes the callback function specified for the
OutputEmptyFcn
property. It can be generated only during an asynchronous write operation.
Pin Status Event. A pin status event is generated immediately after the state (pin
value) changes for the CD, CTS, DSR, or RI pins. Refer to “Serial Port Signals
and Pin Assignments” on page 8-6 for a description of these pins.
This event executes the callback function specified for the
PinStatusFcn
property. It can be generated for both synchronous and asynchronous read and
write operations.
Timer Event. A timer event is generated when the time specified by the
TimerPeriod property passes. Time is measured relative to when the serial
port object is connected to the device.
This event executes the callback function specified for the
TimerFcn property.
Note that some timer events may not be processed if your system is
significantly slowed or if the
TimerPeriod value is too small.
Storing Event Information
You can store event information in an callback function or in a record file.
Event information is stored in a callback function using two fields:
Type and
Data. The Type field contains the event type, while the Data field contains
event-specific information. As described in “Creating and Executing Callback