fscanf warning message

7 views (last 30 days)
Shawn Chang
Shawn Chang on 22 Jun 2012
Commented: Walter Roberson on 16 Jul 2019
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 Comments
Walter Roberson
Walter Roberson on 16 Jul 2019
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.

Sign in to comment.

Accepted Answer

Jan
Jan on 22 Jun 2012
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 Comments
wenshuo dong
wenshuo dong on 1 Aug 2018
Can you tell me what is the problem? how can I figure it out? I meet the same issue as yours. Thanks!

Sign in to comment.

More Answers (0)

Categories

Find more on Instrument Connection and Communication in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!