General Serial Port Parameters
Recording
You control how data and event information are saved to a record (disk) file with these parameters:
- RecordName - Specify the name of the record file.
- RecordMode - Specify whether data and event information are saved to one record file or to multiple record files.
- Overwrite - Overwrite the existing record file.
- Append - Append data to the current record file.
- Index - Create a different record file, each with an indexed filename.
- RecordDetail - Specify the amount of information saved to a record file.
- Verbose - Record the data written to the instrument and the data read from the instrument in addition to recording the information specified by Compact mode.
- Compact - Record the number of values written to the instrument, the number of values read from the instrument, the data type of the values, and event information.
Callbacks
While the serial port object is connected to the instrument, you can use events to execute callbacks. You define the callbacks to execute within an M-file callback function.
- BytesAvailableFcn - Specify the M-file callback function to execute when a specified number of bytes is available in the input buffer, or a terminator is read as defined by the Terminator parameter.
- BytesAvailableFcnMode - Specify if the bytes-available event is generated after a specified number of bytes is available in the input buffer, or after a terminator is read.
- BytesAvailableFcnCount - Specify the number of bytes that must be available in the input buffer before a bytes-available event occurs.
- TimerFcn - Specify the M-file callback function to execute when the time specified by TimerPeriod passes.
- TimerPeriod - Specify the time, in seconds, that must pass before the callback function specified for TimerFcn is called. Time is measured relative to when the object is connected to the instrument.
- BreakInterruptFcn - Specify the M-file callback function to execute when the serial I/O port generates a break interrupt.
- ErrorFcn - Specify the M-file callback function to execute when an error event occurs.
- PinStatusFcn - Specify the M-file callback function to execute when the CD, CTS, DSR, or RI pins change state.
- OutputEmptyFcn - Specify the M-file callback function to execute when the output buffer is empty.
Buffering
Specify the size, in bytes, of the input and output buffer. An error occurs if the transferred data cannot be stored in the associated buffer.
- InputBufferSize - Specify the the total number of bytes that can be stored in the input buffer during a read operation.
- OutputBufferSize - Specify the total number of bytes that can be stored in the output buffer during a write operation.
Timeout
Specify the waiting time, in seconds, to complete a read or write operation. If a timeout occurs, then the read or write operation aborts. If the operation is asynchronous, then an error event is generated.