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 10-7 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 might 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 a 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 Functions” on
Events and Callbacks 10-53 page 10-54, these two fields are associated with a structure that you define in the callback function header. Refer to “Debugging: Recording Information to Disk” on page 10-64 to learn about recording data and event information to a record file. The event types and the values for the Type and Data fields are given below. The Data field values are described below. Table 10-10: Event Information Event Type Field Field Value Break interrupt Type BreakInterrupt Data.AbsTime day-month-year hour:minute:second Bytes available Type BytesAvailable Data.AbsTime day-month-year hour:minute:second Error Type Error Data.AbsTime day-month-year hour:minute:second Data.Message An error string Output empty Type OutputEmpty Data.AbsTime day-month-year hour:minute:second Pin status Type PinStatus Data.AbsTime day-month-year hour:minute:second Data.Pin CarrierDetect , ClearToSend , DataSetReady , or RingIndicator Data.PinValue on or off Timer Type Timer Data.AbsTime day-month-year hour:minute:second
10 Serial Port I/O 10-54 The AbsTime Field. AbsTime is defined for all events, and indicates the absolute time the event occurred. The absolute time is returned using the clock format.
- Fall '19