Generated code from STM32CubeIDE cannot use getchar() to get a charater from HyperTerminal
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-05-15 1:14 AM
Hi
I generated code from STM32CubeIDE.
I cannot use getchar() to get a charater from HyperTerminal.
But I tied to use USART1->RDR. It can get a character as code below.
char ReceiveAByteUART1 = '\0';
printf("\fHardware: STM32L4 Discovery kit IoT node (B-L475E-IOT01A)r\n>");
fflush(stdout);
if(USART1->ISR & USART_ISR_RXNE) //Bit 5 RXNE: Read data register not empty
{
ReceiveAByteUART1 = getchar();
putchar(ReceiveAByteUART1); // Display a character.
fflush(stdout);
}
But I can use above code on Keil uVision5.
Could you help me to solve this problem?
Thank you
Labels:
- Labels:
-
STM32CubeIDE
-
UART-USART
This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0
