serial vs. serialport

조회 수: 16 (최근 30일)
David Brook
David Brook 2020년 5월 28일
답변: Manas Meena 2021년 2월 9일
Can anyone inform me how the new 'serialport' differs from the old 'serial' aside from syntax/terminology? Are there differences 'under the hood' as it were?
I'm trying to set up communication with an instrument and have found that while the old style 'serial' works fine, using a 'serialport' object doesn't work. I can connect to the instrument with either, but when I send a script for the instrument to execute, it somehow gets garbled with 'serialport' such that the instrument throws syntax errors when it tries to parse it.
The script is sent line by line as ascii characters, each line is terminated with a LF.
serial using fprintf and fscanf works fine.
serialport using writeline and readline does not, though the documentation says they are equivalent. The only other difference in the code is that with the oldstyle 'serial' I have to specifically open and close the port.
Dave

답변 (1개)

Manas Meena
Manas Meena 2021년 2월 9일

카테고리

Help CenterFile Exchange에서 Serial and USB Communication에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by