Hi all,
I am new to keil uvision and micro-controller. I am having problem with my program which is use USART to communicate with Hyperterminal. STM32F10, Keil uvision and J-Link debugger was used. Below is my code and error, please help me . Thanks in advance.
int main (void)
{
stm32_Init (); // STM32 setup
while (1)
{ int i = 0;
unsigned char c[255];
printf ("\r\nPress text here: \r\n");
while(1)
{ fflush (stdin);
c = getchar();
i++;
if (c[i-1] == '\r')
{ printf("You pressed %s\r\n\r\n", c);
printf("Press a key...\r\n");
i = 0;
memset (c, 0, 255);
}
}
}
}
Problem on Hyperterminal:
En
Press a key...
En
Press a key...
¿«ÁÉÍÍ)jj¤Ô%ÍÍ *å¹¹rjR
üß«ÁÉÍÍ)jj¤Ô%ÍÍ *å¹¹rjR
üß«ÁÉÍÍ)jj¤Ô%ÍÍ *å¹¹rjR
--->funny character as I pressed <enter> key at the mid of keyboard, when other key was functioning well.
I am new to keil uvision and micro-controller. I am having problem with my program which is use USART to communicate with Hyperterminal. STM32F10, Keil uvision and J-Link debugger was used. Below is my code and error, please help me . Thanks in advance.
int main (void)
{
stm32_Init (); // STM32 setup
while (1)
{ int i = 0;
unsigned char c[255];
printf ("\r\nPress text here: \r\n");
while(1)
{ fflush (stdin);
c = getchar();
i++;
if (c[i-1] == '\r')
{ printf("You pressed %s\r\n\r\n", c);
printf("Press a key...\r\n");
i = 0;
memset (c, 0, 255);
}
}
}
}
Problem on Hyperterminal:
En
Press a key...
En
Press a key...
¿«ÁÉÍÍ)jj¤Ô%ÍÍ *å¹¹rjR
üß«ÁÉÍÍ)jj¤Ô%ÍÍ *å¹¹rjR
üß«ÁÉÍÍ)jj¤Ô%ÍÍ *å¹¹rjR
--->funny character as I pressed <enter> key at the mid of keyboard, when other key was functioning well.