This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Property Reference

Configure Serial Port Properties

Properties can be set after you create the serial object. A read-only property is called as follows.

s = serial('COM1');
s.TransferStatus
ans = 
     idle

A property you can configure is set as follows.

s = serial('COM1');
s.Timeout = 30;

Serial Port Object Properties

The serial port object properties are briefly described below, and organized into categories based on how they are used.

Communications Properties  

'BaudRate'

Rate at which bits are transmitted

'DataBits'

Number of data bits to transmit

'Parity'

Type of parity checking

'StopBits'

Number of bits used to indicate the end of a byte

'Terminator'

Terminator character

Write Properties 

BytesToOutput

Number of bytes currently in the output buffer

OutputBufferSize

Size of the output buffer in bytes

Timeout

Waiting time to complete a read or write operation

TransferStatus

Indicate if an asynchronous read or write operation is in progress

ValuesSent

Total number of values written to the device

Read Properties 

BytesAvailable

Number of bytes available in the input buffer

InputBufferSize

Size of the input buffer in bytes

ReadAsyncMode

Specify whether an asynchronous read operation is continuous or manual

Timeout

Waiting time to complete a read or write operation

TransferStatus

Indicate if an asynchronous read or write operation is in progress

ValuesReceived

Total number of values read from the device

Callback Properties 

BreakInterruptFcn

Callback function to execute when a break-interrupt event occurs

BytesAvailableFcn

Callback function to execute when a specified number of bytes is available in the input buffer, or a terminator is read

BytesAvailableFcnCount

Number of bytes that must be available in the input buffer to generate a bytes-available event

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

ErrorFcn

Callback function to execute when an error event occurs

OutputEmptyFcn

Callback function to execute when the output buffer is empty

PinStatusFcn

Callback function to execute when the CD, CTS, DSR, or RI pins change state

TimerFcn

Callback function to execute when a predefined period of time passes

TimerPeriod

Period of time between timer events

Control Pin Properties  

DataTerminalReady

State of the DTR pin

FlowControl

Data flow control method to use

PinStatus

State of the CD, CTS, DSR, and RI pins

RequestToSend

State of the RTS pin

Recording Properties 

RecordDetail

Amount of information saved to a record file

RecordMode

Specify whether data and event information are saved to one record file or to multiple record files

RecordName

Name of the record file

RecordStatus

Indicate if data and event information are saved to a record file

General Purpose Properties  

'ByteOrder'

Order in which the device stores bytes

Name

Descriptive name for the serial port object

'port'

Platform-specific serial port name

Status

Indicate if the serial port object is connected to the device

Tag

Label to associate with a serial port object

Type

Object type

UserData

Data you want to associate with a serial port object