Main Content

Configure Serial Port Communication Settings

Before you can write or read data, both the serial port object and the instrument must have identical communication settings. Configuring serial port communications involves specifying values for properties that control the baud rate and the Serial Data Format. These properties are as follows.

Serial Port Communication Properties

Property Name



Specify the rate at which bits are transmitted.


Specify the type of parity checking.


Specify the number of data bits to transmit.


Specify the number of bits used to indicate the end of a byte.


Specify the terminator character.


If the serial port object and the instrument communication settings are not identical, you might not be able to successfully read or write data.

Refer to your instrument documentation for an explanation of its supported communication settings.

You can display the communication property values for the serial port object s created in Create Serial Port Object.

s = serialport("COM4",9600)
s = 

  Serialport with properties:

                 Port: "COM4"
             BaudRate: 9600
    NumBytesAvailable: 0

  Show all properties, all methods

                      Port: "COM4"
                  BaudRate: 9600
         NumBytesAvailable: 0

                 ByteOrder: "little-endian"
                  DataBits: 8
                  StopBits: 1
                    Parity: "none"
               FlowControl: "none"
                   Timeout: 10
                Terminator: "LF"

     BytesAvailableFcnMode: "off"
    BytesAvailableFcnCount: 64
         BytesAvailableFcn: []
           NumBytesWritten: 0

          ErrorOccurredFcn: []
                  UserData: []