Several questions concerning serial communication

조회 수: 3 (최근 30일)
Florian
Florian 2014년 7월 17일
Hi,
I am currently programming a Matlab Script(with GUI via guide) to make use of a measurement system from the 90s that is connected via RS-232 to the computer.
I have several questions concerning the serial communication:
1. Is there a way to close the serial connection I opened in the script via workspace? When I am debugging my code and there is an error before the connection is closed I now need to restart Matlab. "fclose('all')" sadly doesn't work.
2. After I hit start on the Gui I want to read from the serial port as long as there is an inflow or I press the stop Button. I tried a global variables that turns on after the "Stop" button is pressed.
while isstopped == 0 && its.BytesAvailable > 0
income = fgetl(its)
.
.
.
But even though I set the ReadAsyncMode of the connection to continouus the income stops after approximately 30 lines. The Stopbutton doesn't work either.
I am grateful for any answers.
Best Regards,
Florian

답변 (0개)

카테고리

Help CenterFile Exchange에서 Desktop에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by