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.
Well, scanf now works fine. I can read signed int, hex and float. :-) But every received sign is echoed by scanf.
while(1) { printf("Enter your personal secret Hex-key!\n"); if (scanf("%X",&A)) break; scanf("%*"); //Clearing scanf input stream }
Now i have this solution, works pretty well.
//*********************************************************************** //* putchar & _getkey for the ADuC7026 //* 24.04.2006 : Echo cancellation //*********************************************************************** #include <aduc7026.h> #define CR 0x0D #pragma thumb static int Echo_flag; //*********************************************************************** int putchar(int ch) /* Write character to Serial Port */ { if (!Echo_flag) { if (ch == '\n') //additional CR { while(!(COMSTA0 & 0x020)){} COMTX = CR; } while(!(COMSTA0 & 0x020)){} COMTX = ch; } Echo_flag = 0; //Echo on for next call of putchar return (ch); } //*********************************************************************** int _getkey (void) { while(!(COMSTA0 & 0x01)){} //waits until a sign appears in COMRX Echo_flag = 1; //Echo off for next call of putchar return (COMRX); } //***********************************************************************