We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi. I'm using an eval board with C1610 (Phytec KC161). I know that KEIL doesn't have the function kbhit(). But I need somthing like that function, is it posible to make one? If does anyone know, please give me ideeas, or, the body of he function, even it is for over device. Thank you.
I soleved the problem, I had to delete the S0RIR at the end of the body of if(kbhit()){...} It work fine , with scanf()...
I think the instruction scanf("%s", command) can read the command I want.
How large is the command buffer?
Try to send a couple of extra characters to the unit, and check what happens with your other RAM variables stored directly after the command buffer...
gets() and scanf() are two of the most dangerous functions available in the C library, and you specifically want to use them despite being warned?
Immediately plan for using the watchdog in the processor. You might need it sooner than you think. However, the watchdog can only help to restart a hung application. It will not protect the application from producing erroneous results, caused by buffer overruns.
If you really have decided to use scanf(), at least always specify a maximum field width when retrieving strings. Without a field width, scanf() will behave similar to gets() - trying to receive any number of characters, whatever the size of your buffer is!