fscanf warning message

조회 수: 2 (최근 30일)
Shawn Chang
Shawn Chang 2012년 6월 22일
댓글: Walter Roberson 2019년 7월 16일
Hi, I am using serial port communication. I can write and read the data but the warning after "fscanf" keep pop up. Below attached the code. Code:
s=serial('COM6','BaudRate',115200,'Parity','none'...
,'DataBits',8,'FlowControl','none'...
,'Terminator','LF/CR');
fopen(s);
fprintf(s,'t');
out = fscanf(s)
Warning: A timeout occurred before the Terminator was reached.
May i know what is the problem?
  댓글 수: 2
Abhirama B A
Abhirama B A 2019년 7월 16일
I am also having the same problem even after using the code
set(s, 'TimeOut', 100)
can you help to get rid of this?
Walter Roberson
Walter Roberson 2019년 7월 16일
Check the baud rate you are configuring.
Check that the terminator matches.
Use a program such as TeraTerm to verify that you are able to receive data from the port.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2012년 6월 22일
If the timeout occurred to early, what about increasing the time?
set(s, 'TimeOut', 100)
? But the default of 10 seconds should be long enough... Perhaps the other parameters are not correct?
  댓글 수: 5
Shawn Chang
Shawn Chang 2012년 6월 28일
Thanks Jan and Walter replied, now I know how the stuff is worked.
wenshuo dong
wenshuo dong 2018년 8월 1일
Can you tell me what is the problem? how can I figure it out? I meet the same issue as yours. Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by