Serielle und USB-Kommunikation
Die serielle Kommunikation ist das am häufigsten verwendete Low-Level-Protokoll für die Kommunikation zwischen zwei oder mehr Geräten. Normalerweise handelt es sich bei einem Gerät um einen Computer, während das andere Gerät ein Modem, ein Drucker, Arduino®-Hardware, ein weiterer Computer oder ein wissenschaftliches Instrument, etwa ein Oszilloskop oder ein Funktionsgenerator, sein kann. Bei vielen seriellen Schnittstellen-Anwendungen können Sie eine Kommunikation mit Ihrem Gerät aufbauen, ohne genau zu wissen, wie die serielle Schnittstelle funktioniert. Die Kommunikation über eine serielle Schnittstelle wird über ein serialport-Objekt eingerichtet, das Sie im MATLAB® Workspace erstellen. Weitere Informationen zum Erstellen eines serialport-Objekts finden Sie unter Create Serial Port Object.
Bevor Sie Daten schreiben oder lesen können, müssen das serialport-Objekt und das Gerät identische Kommunikationseinstellungen besitzen. Informationen finden Sie unter Configure Serial Port Communication Settings.
Funktionen
Apps
| Serial Explorer | Communicate with devices connected to serial port (Seit R2021b) |
| Hardware Manager | Discover and get started with your hardware (Seit R2022a) |
Themen
- 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
serialportinstead ofserial.
Fehlersuche
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.

