Mathlab can not write data to serial port suddenly!

Hello I use Mathlab to send data via to microcontroller. I done this already. But just yesterday, Mathlab can not send to serial port suddenly. I don't know this why? I didn't change the code. Everything is correct. No error, no warning. I checked serial port information: serial-COM1 Status: open Baudrate: 9600 Terminator: CR/LF I use "fwrite" and "fprintf" function to send to microcontroller.In Mathlab, no error, the ValueSent is also increasing but device can not receive the data. Note that I used Terminal to send to microcontroller. It work fine. Please explane to me

回答 (1 件)

David Sanchez
David Sanchez 2013 年 5 月 30 日

0 投票

You may have created the serial object and are actually sending the signal to it, that is why no errors are returned. Make sure the COM number assigned to your devices has not changed.

3 件のコメント

Duong Tu
Duong Tu 2013 年 5 月 30 日
Yes! the COM number assigned to my device has not change. I use Terminal GUI for sending data. It work fine. Same condition, Terminal work fine but Mathlab is not
David Sanchez
David Sanchez 2013 年 5 月 30 日
Are you sure not other application holds the serial port?
Duong Tu
Duong Tu 2013 年 5 月 30 日
I am sure that others application don't hold the serial port. Because I use "instrfindall" to check available ports. If any application hold the serial port, Mathlab will not creat serial object which use that port.

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

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

質問済み:

2013 年 5 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by