Is there an equivalent serialbreak() function with the new serialport class in MATLAB 2020b?

4 ビュー (過去 30 日間)
Matthew Feemster
Matthew Feemster 2020 年 10 月 23 日
回答済み: Michael 2023 年 11 月 20 日
MATLAB is recommending the switch to serialport as opposed to serial. With the old serial class, you could send a serialbreak() command. With the new serialport() class, I cannot locate a similar functionality. Is there a way to do this? Thanks.
------------------------------------------------------------------------------------
% Old way.
mbed = serial('COM9');
fopen(mbed);
serialbreak(mbed,1);
% New way.
mbed = serialport('COM9',9600);
% How do I send serial break with this new class?

回答 (2 件)

Pratyush Roy
Pratyush Roy 2020 年 10 月 27 日
Hi Matthew,
As of MATLAB R2019b there is no builtin function to send a serial break to the 'serialport' object. Instead this will have to be done manually by sending 0 bits to the device for a certain amount of time, depending on the device. For example you can manually write 0s for the necessary amount of time:
write(s,zeros(1,amount),"uint8")
Hope this helps !!
  5 件のコメント
Walter Roberson
Walter Roberson 2022 年 5 月 24 日
Mike Koko:
You will need to raise this as a technical support case to emphasize to Mathworks that it is needed.
The new interface is, in my opinion, not currently suitable for controlling a serial port.
There was a time when I wrote modem control software, and data transfer software over dialup. I was a systems administrator for an ISP with international nodes. The current serialport() interface would not be usable for that kind of purpose.
Mike Kokko
Mike Kokko 2022 年 5 月 24 日
@Walter Roberson Thank you very much, I will do that.

サインインしてコメントする。


Michael
Michael 2023 年 11 月 20 日

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by