Comunicación en serie y USB
La comunicación en serie es el protocolo de bajo nivel más común para la comunicación entre dos o más dispositivos. Por lo general, un dispositivo puede ser un ordenador, mientras que el otro puede ser un módem, una impresora, hardware Arduino®, otro ordenador o un instrumento científico, como un osciloscopio o un generador de funciones. Para muchas aplicaciones de puerto serie, es posible comunicarse con el instrumento sin que sea necesario conocer en detalle cómo funciona el puerto serie. La comunicación a través de un puerto serie se establece con un objeto serialport, que se crea en el área de trabajo de MATLAB®. Para obtener información sobre la creación de un objeto serialport, consulte Crear objeto de puerto serie.
Para poder escribir o leer datos, el objeto serialport y el instrumento deben tener una configuración de comunicación idéntica. Para obtener información, consulte Configure Serial Port Communication Settings.
Funciones
Apps
| Serial Explorer | Communicate with devices connected to serial port (Desde R2021b) |
| Hardware Manager | Discover and get started with your hardware (Desde R2022a) |
Temas
- Serial Port Overview
Basic features of serial port communication.
- Crear objeto de puerto serie
Establezca una conexión entre MATLAB y el dispositivo mediante el puerto serie.
- 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.
Solución de problemas
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.

