Asynchronous read\write via serial port (App designer)

11 ビュー (過去 30 日間)
Andrei Shumski
Andrei Shumski 2021 年 12 月 7 日
編集済み: Suman 2024 年 6 月 18 日
I used serial.
and used func for serial fwrite(app.s, values, 'uint8', 'async'). I could select property 'async' to write to serial port.
Matlab tells me: serial will be removed in a future release. Use serialport instead.
How can I use property 'async' for serialport? I need to write/read asynchronous via serialport.

回答 (1 件)

Suman
Suman 2024 年 6 月 18 日
編集済み: Suman 2024 年 6 月 18 日
Hi Andrei,
There is no 'async' property for serialport. In order to read data asynchronously using serialport, you can use the configureCallback function to set a callback function that will be triggered everytime a given bytes of data is available to read.
As for writing data asynchronously, the write and writeline are blocking functions and as per the changes mentioned here about changes from serial to serialport, https://www.mathworks.com/help/matlab/import_export/transition-your-code-to-serialport-interface.html it seems that there is no direct way to write data asynchronously.

カテゴリ

Help Center および File ExchangeSerial and USB Communication についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by