Specify number of bits used to indicate end of byte
You can configure StopBits
to be 1
, 1.5
,
or 2
for serial port objects, or 1
or 2
for
VISA-serial objects If StopBits
is 1
,
one stop bit is used to indicate the end of data transmission. If StopBits
is 2
,
two stop bits are used to indicate the end of data transmission. If StopBits
is 1.5
,
the stop bit is transferred for 150% of the normal time used to transfer
one bit.
Note
Both the computer and the instrument must be configured to transmit the same number of stop bits.
In addition to the stop bits, the serial data format consists
of a start bit, between five and eight data bits, and possibly a parity
bit. You specify the number of data bits with the DataBits
property,
and the type of parity checking with the Parity
property.
Usage | Serial port, VISA-serial |
Read only | Never |
Data type | double |
| One stop bit is transmitted to indicate the end of a byte. |
| The stop bit is transferred for 150% of the normal time used to transfer one bit. |
| Two stop bits are transmitted to indicate the end of a byte. |
| One stop bit is transmitted to indicate the end of a byte. |
| Two stop bits are transmitted to indicate the end of a byte |
This example shows how to set the StopBits
for
a serial port object.
Create a serial port object associated with the COM1 port. The
default setting for StopBits
is 1
for
serial port objects. Change the value to use two stop bits to indicate
the end of data transmission.
s = serial('COM1'); s.StopBits = 2;