How can I read the whole input buffer of a serial port object?
이전 댓글 표시
I am communicating with a device via rs-232 and I would like to read the whole iput buffer of the serial object at once.
What I already tried was:
s = serial('com1');
fopen(s);
fscanf(s,'%f',s.bytesavailable);
So when I run the code I only get the last value instead of the whole input buffer.
Do you have a clue what the issue could be?
채택된 답변
추가 답변 (1개)
Valentino Tomasic
2015년 6월 22일
0 개 추천
댓글 수: 1
Walter Roberson
2015년 6월 22일
Is the input terminated somehow? linefeed? Or even just a comma between entries? If so then you should be programming a bytesavailablefcn callback. That callback can grab values from the serial port and store them away for a later run of the processing loop. For example you could keep a circular buffer, such as is shown blog or file exchange
카테고리
도움말 센터 및 File Exchange에서 Desktop에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!