- Jan 15, 2005
- 4,327
- 1
- 0
Hey, long time since I've browsed these forums
I have a microcontroller which I'm trying to talk to through SecureCRT on a COM port.
I have a simple loop:
But on the next iteration of the loop it assumes that the same character was scanned and it outputs it again and again. It essentially skips over the scanf line. Typing a new character won't work either
Output:scanning....
Input: 1\n
Output:scannedchar: 1
scanning....
1 scanned char: 1\n
scanning.....
1 scanned char: 1
Anyone know what the deal is?
I have a microcontroller which I'm trying to talk to through SecureCRT on a COM port.
I have a simple loop:
It types in "scanning..." and waits for me to type in a character, but it must be followed by a line feed (\n). Once it scans it outputs the scanned character... as plannedchar c;
//Set up UART ports...etc
while (1)
{
printf ("scanning...\n");
scanf("%c", &c);
printf ("scanned char: %c\n",c);
}
But on the next iteration of the loop it assumes that the same character was scanned and it outputs it again and again. It essentially skips over the scanf line. Typing a new character won't work either
Output:scanning....
Input: 1\n
Output:scannedchar: 1
scanning....
1 scanned char: 1\n
scanning.....
1 scanned char: 1
Anyone know what the deal is?