fscanf warning message

Asked by Shawn Chang on 22 Jun 2012
Latest activity Commented on by Shawn Chang on 28 Jun 2012

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?

0 Comments

Shawn Chang

Products

No products are associated with this question.

1 Answer

Answer by Jan Simon on 22 Jun 2012
Accepted answer

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?

4 Comments

Shawn Chang on 25 Jun 2012

Hi, thanks for replied. After i set the time out to 100,and check the terminator, the warning still exist. Does the warning will affect thereceiving data?

Walter Roberson on 25 Jun 2012

The warning might be indicating that you are not getting any data at all.

If you are getting data then the timeout will be slowing down your program a lot.

Shawn Chang on 28 Jun 2012

Thanks Jan and Walter replied, now I know how the stuff is worked.

Jan Simon

Contact us