Discussion Forum

scanf in uvison for mcb2300

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
chris gerretsen
Posted
14-Feb-2010 01:27 GMT
Toolset
ARM
New! scanf in uvison for mcb2300

Hi,I want to read in some data from for example hyperterminal and use it in uvision to further exucate in calculation etc.

Is it simply scanf(" %d , &etc) ???

Read-Only
Author
Al Bradford
Posted
14-Feb-2010 17:03 GMT
Toolset
ARM
New! RE: scanf in uvison for mcb2300

Look at the example code for RTX-Blinky in the ...boards/keil/mcb2300 folder. It is an RTX example but it shows one method of keyboard input via UART.
Bradford

Read-Only
Author
Thorsten de Buhr
Posted
15-Feb-2010 07:58 GMT
Toolset
ARM
New! RE: scanf in uvison for mcb2300

Hi,

you have to do some basic retargeting work.
Search for a file called "retarget.c". You'll find more different files of it, from a very basic file up to a more deep retargeting.

The retargeting can be done on two levels:
1. fputc, fgetc
2. _sys_x functions

The stdio functions call (just an overview):

(f)printf --> fputc --> lib --> _sys_write
(f)scanf  --> fgetc --> lib --> _sys_read
fopen     -->           lib --> _sys_open
fclose    -->           lib --> _sys_close

If you'd like to have more detailed information on retargeting, please write an email to http://www.keil.com/support/gethelp.asp and I'll help with source code :-)

BR,
/th.

Read-Only
Author
chris gerretsen
Posted
15-Feb-2010 14:02 GMT
Toolset
ARM
New! RE: scanf in uvison for mcb2300

Many Thanks for your help guys.

Basically I want to set up a menu type system for the mcb2300,so a command from the keyboard triggers the next stage of the program etc.

I do have the retarget.c and will give what you have suggested so far but will surely have a few more questions in the not so distant future.

thanks again

Read-Only
Author
Andrew Neil
Posted
15-Feb-2010 09:47 GMT
Toolset
None
New! "simply" (sic) scanf

Note that using scanf is not necessarily "simple" - irrespective of whether it's in an embedded target, or anywhere else!

Try searching this forum for "scanf"...

You might find it easier to develop your own parser - in particular for handling "unexpected" data and/or formatting...

Next Thread | Thread List | Previous Thread Start a Thread | Settings