User`s manual

8 Serial Port I/O
8-12
When reading or writing data, you may need to specify a value, which can
consist of one or more bytes. For example, if you read one value from a device
using the
int32 format, then that value consists of four bytes. For more
information about reading and writing values, refer to “Writing and Reading
Data” on page 8-29.
Synchronous and Asynchronous Communication
The RS-232 standard supports two types of communication protocols:
synchronous and asynchronous.
Using the synchronous protocol, all transmitted bits are synchronized to a
common clock signal. The two devices initially synchronize themselves to each
other, and then continually send characters to stay synchronized. Even when
actual data is not really being sent, a constant flow of bits allows each device
to know where the other is at any given time. That is, each bit that is sent is
either actual data or an idle character. Synchronous communications allows
faster data transfer rates than asynchronous methods, because additional bits
to mark the beginning and end of each data byte are not required.
Using the asynchronous protocol, each device uses its own internal clock
resulting in bytes that are transferred at arbitrary times. So, instead of using
time as a way to synchronize the bits, the data format is used.
In particular, the data transmission is synchronized using the start bit of the
word, while one or more stop bits indicate the end of the word. The requirement
to send these additional bits causes asynchronous communications to be
slightly slower than synchronous. However, it has the advantage that the
processor does not have to deal with the additional idle characters. Most serial
ports operate asynchronously.
Note When used in this guide, the terms “synchronous” and “asynchronous”
refer to whether read or write operations block access to the MATLAB
command line. Refer to “Controlling Access to the MATLAB Command Line”
on page 8-29 for more information.
How Are the Bits Transmitted?
By definition, serial data is transmitted one bit at a time. The order in which
the bits are transmitted is given below: