Serielle Schnittstelle
Die serielle Kommunikation ist das am häufigsten verwendete Low-Level-Protokoll für die Kommunikation zwischen zwei oder mehr Geräten. Normalerweise ist ein Gerät ein Computer, während das andere Gerät ein Modem, ein Drucker, Arduino®-Hardware, ein anderer Computer oder ein wissenschaftliches Instrument wie ein Oszilloskop oder ein Funktionsgenerator sein kann. Bei vielen Anwendungen für die serielle Schnittstelle können Sie mit Ihrem Instrument kommunizieren, ohne detaillierte Kenntnisse über die Funktionsweise der seriellen Schnittstelle zu haben. Die Kommunikation über eine serielle Schnittstelle wird mit einem serialport-Objekt hergestellt, das Sie im MATLAB®-Workspace erstellen. 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 Instrument über identische Kommunikationseinstellungen verfügen. Weitere Informationen finden Sie unter Configure Serial Port Communication Settings.
Funktionen
Apps
| Serial Explorer | Communicate with devices connected to serial port (Seit R2021b) |
Blöcke
| Serial Configuration | Configure parameters for serial port |
| Serial Receive | Receive binary data over serial port |
| Serial Send | Send binary data over serial port |
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.
- 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.



