このページは機械翻訳を使用して翻訳されました。最新版の英語を参照するには、ここをクリックします。
シリアルポートインターフェース
シリアル通信は、2 つ以上のデバイス間で通信するための最も一般的な低レベル プロトコルです。通常、1 つのデバイスはコンピュータであり、もう 1 つのデバイスはモデム、プリンタ、Arduino® ハードウェア、別のコンピュータ、またはオシロスコープや関数ジェネレータなどの科学機器です。多くのシリアル ポート アプリケーションでは、シリアル ポートの動作に関する詳細な知識がなくても、計測器と通信できます。シリアル ポートを介した通信は、MATLAB® ワークスペースで作成した serialport オブジェクトによって確立されます。serialport オブジェクトの作成については、Create Serial Port Object を参照してください。
データの書き込みまたは読み取りを行う前に、serialport オブジェクトと計測器の通信設定が同一である必要があります。詳細については、Configure Serial Port Communication Settingsを参照してください。
関数
アプリ
| Serial Explorer | Communicate with devices connected to serial port (R2021b 以降) |
ブロック
| Serial Configuration | Configure parameters for serial port |
| Serial Receive | Receive binary data over serial port |
| Serial Send | Send binary data over serial port |
トピック
- 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.
トラブルシューティング
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.



