How to use scanf to get values from the keyboard

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to use scanf to get values from the keyboard

331件の閲覧回数
Transidico
Contributor III

Good morning,

I am trying to use the Hello World demo to see how the terminal works using mcxc242.

I am using teraterm. I can see PRINTF correctly, but GETCHAR() or SCANF() to send values from the keyboard does not seem to work.

Is there anything I need to enable?

Thank you for your reply.

0 件の賞賛
返信
5 返答(返信)

253件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Transidico 

Please test using the SDK demo hello_world. I have tested it on the FRDM-MCXC242 board, and the GETCHAR() function works properly.
Please choose UART console on SDK Debug Console:
Alice_Yang_1-1757477478093.png

 

If you still have issues, please check your hardware connections—specifically, whether the UART RX pin is connected correctly.
If you are using your own custom board, you may also send us your schematic for reference. If you are using an NXP DEMO board, please take a photo of the jumpers, I help you check. 
 

Thank you. 

 

BR

Alice

 

BR

Alice

0 件の賞賛
返信

314件の閲覧回数
Transidico
Contributor III
It works on the integrated console, but not on Teraterm or other Terminal.
0 件の賞賛
返信

294件の閲覧回数
ErichStyger
Specialist I

Are you using the UART or semihosting for your input/output?

Typically, most terminal views do not support semihosting, but built-in terminal views in the IDE might support it.

And if using semihosting, most implementation do only implement output, no input. If you want input, you have to use a library like this one: https://mcuoneclipse.com/2023/03/09/using-semihosting-the-direct-way/

I hope this helps,

Erich

0 件の賞賛
返信

286件の閲覧回数
Transidico
Contributor III

Good morning,

With semihost, both input and output work via the mcxpresso console, whereas if I enable it with uart, I see it working on the teraterm terminal only in output, not in input. I am not using the external debugger, only USB.

I don't really care which mode I choose (UART or semihost), the important thing is that I can get the characters from the keyboard via Teraterm.

What should I do? Is it possible without an external debugger?

Thanks in advance, bye.

 

 

 

Translated with DeepL.com (free version)

0 件の賞賛
返信

284件の閲覧回数
ErichStyger
Specialist I

Yes, you can read from the UART console too.

Can you check your _read() function? This is where it gets the data.

0 件の賞賛
返信