fscanf warning message

7 Ansichten (letzte 30 Tage)
Shawn Chang
Shawn Chang am 22 Jun. 2012
Kommentiert: Walter Roberson am 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 Kommentare
Abhirama B A
Abhirama B A am 16 Jul. 2019
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 am 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 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 Kommentare
Shawn Chang
Shawn Chang am 28 Jun. 2012
Thanks Jan and Walter replied, now I know how the stuff is worked.
wenshuo dong
wenshuo dong am 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!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by