Serial and USB Communication
Serial communication is the most common low-level protocol for communicating between two or
more devices. Normally, one device is a computer, while the other device can be a modem, a
printer, Arduino® hardware, another computer, or a scientific instrument such as an oscilloscope
or a function generator. For many serial port applications, you can communicate with your
instrument without detailed knowledge of how the serial port works. Communication through a
serial port is established with a
serialport object, which you create in
the MATLAB® workspace. For information about creating a
object, see Create Serial Port Object.
Before you can write or read data, the
serialport object and the instrument
must have identical communication settings. For information, see Configure Serial Port Communication Settings.
Connect and Configure
|List of serial ports connected to your system|
|Connection to serial port|
|Set terminator for ASCII string communication with serial port|
|Set callback function and trigger condition for communication with serial port device|
Read and Write
Control Pins and Memory
|Clear serial port device buffers|
|Get serial pin status|
|Set serial RTS pin|
|Set serial DTR pin|
|Serial Explorer||Communicate with devices connected to serial port|
|Hardware Manager||Discover and get started with your hardware|
- Serial Port Overview
Basic features of serial port communication.
- Create Serial Port Object
Establish a connection between MATLAB and the device using the serial port.
- Configure Serial Port Communication Settings
Set properties associated with the device baud rate and serial data format.
- Write and Read Serial Port Data
Write and read both text and binary data with a serial port device.
- Use Callbacks for Serial Port Communication
Enhance instrument communication by executing a callback function when a specified event occurs on the device.
- Use Serial Port Control Pins
Signal the presence of connected devices and control the flow of data using control pins.
- Get Started with Hardware Manager
Get the apps and add-ons to access your hardware from MATLAB.
- Transition Your Code to serialport Interface
Connect to serial port devices using
Troubleshooting Serial Port Interface
Troubleshoot the Serial Port interface.
Resolve Serial Port Connection Errors
Troubleshoot connecting to a serial port device.
Serialport Warning - Unable to Read All Data
Try these remedies when you receive some data, and you get the warning message: 'serialport' unable to read all requested data.
Serialport Warning - Unable to Read Any Data
Try these remedies when you receive no data, and you get the warning message: 'serialport' unable to read any data.