Several questions concerning serial communication

2 visualizzazioni (ultimi 30 giorni)
Florian
Florian il 17 Lug 2014
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

Risposte (0)

Categorie

Scopri di più su Desktop in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by