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 problem

Hello,I would like to read data from hyperterminal and use it in uvision for further calculation. however, It seems to me that scanf is not working.
Any help, will be appreciated.
thanks in advance.

int main (void)
{
float i;
printf ("Enter value");
scanf ("%f", &i);
}

  • Why do you want uvision to use data from the hyper terminal?

    You are aware, that uvision is the IDE (editor/debugger/compiler) you are using, aren't you? Yes - the debugger has a programming language, but not intended for processing data from the hyper terminal program.

    Next issue - if you do use uvision to write an embedded application and want that application to use printf() and scanf() you have to consider what device that is your console. Is it one of the UART? In that case - which of them? Or is it a SPI interface? Something else? Embedded devices don't normally come shipped from the manufacturer with a dedicated console - so you have to create the stub functions that integrates the runtime library with your actual hardware.

  • Hi,

    you can use the simulated UART Windows, or (if you are using a Cortex-M3 and your debug Adapter supports SWO, i.e. ULINK, JLink) use the ITM printf Window.

    You have to write the low level functions, see Retargetc. in many Keil demo projects.
    When running on a Cortex-M3 there are ITM_Sendchar(char c) and a ITM_ReceiveChar() you can use to transfehr the characters.

    All Terminal Windows in µVision have a basic VT100 support (cursor positioning, clear screen, clear line, cursor keys are transmitted, ...).

    .
    BR,
    /th.