This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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) ???

  • 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

  • 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 www.keil.com/.../gethelp.asp and I'll help with source code :-)

    BR,
    /th.

  • 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...

  • 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