Problem with TeraTerm and scanf()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with TeraTerm and scanf()

1,719 Views
kirantujare
Contributor IV

I was working on FRDM K64F using KDS

My code is working correctly on teraterm but I cannot see the scanf values I enter. It does the calculation correctly though. Also the teraterm output is spaced. I have attached how my output looks on tera term

Labels (1)
0 Kudos
Reply
2 Replies

1,237 Views
TomE
Specialist II

K64F is Kinetis. This is the Coldfire forum.

Between your code and Teraterm you need code equivalent to a "terminal driver".

These can get horribly complicated, but at a basic level you expect "hello world\n" to print with a carriage return as well as the line feed. So if you changed your code to "hello world\r\n" it would look more normal. So a normal function of a Terminal Driver is to convert all "\n" on output to "\r\n".

It also echoes all input that you type back to the output so you can see what you're entering.

And for bonus points it should let you EDIT your response, at a minimum allowing you to backspace over what you typed, and only forwarding the edited result to your program when you hot "return".

The development board may come with software to do that, but you may have bypassed it to call the serial port directly. See if you can find one (and ask on the Kinetis forum). Or you could write one. Or you could write your code to explicitly (or via a function) emit "\r\n" and echo input characters.

Somehow the "scanf()" call is linked up to the serial driver somehow. just not through something standard or smart enough. There may be a project option somewhere.

Tom

0 Kudos
Reply

1,237 Views
kirantujare
Contributor IV

Thank you! I got it figured out.
To use scanf(), I had to use debug_scanf and it worked

0 Kudos
Reply