stm32串口实验的问题,求帮助
时间:10-02
整理:3721RD
点击:
程序作用为从键盘输入字符到开发板,超级终端会收到相同字符
请问程序是如何执行的?红色部分什么意思?
#pragma import(__use_no_semihosting_swi)
#define PRINT_ON_LCD
USART_InitTypeDef USART_InitStructure;
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif
#ifdef PRINT_ON_LCD
void Display_Init(void);
void Display(void);
#endif
int main(void)
{
#ifdef PRINT_ON_LCD
Display_Init();
Display();
#endif
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
STM_EVAL_COMInit(COM1, &USART_InitStructure);
printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");
while (1)
{
请问程序是如何执行的?红色部分什么意思?
#pragma import(__use_no_semihosting_swi)
#define PRINT_ON_LCD
USART_InitTypeDef USART_InitStructure;
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif
#ifdef PRINT_ON_LCD
void Display_Init(void);
void Display(void);
#endif
int main(void)
{
#ifdef PRINT_ON_LCD
Display_Init();
Display();
#endif
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
STM_EVAL_COMInit(COM1, &USART_InitStructure);
printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");
while (1)
{
找本C语言的书看看吧。
是定义一个函数或变量的语句啊