int main(void)
{
// 配置串口参数
/* USARTx configured as follow:
- BaudRate = 115200 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Hardware flow control disabled (RTS and CTS signals)
- Receive and transmit enabled
*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB, ENABLE); /*使能LED灯使用的GPIO时钟*/
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);
/* Output a message on Hyperterminal using printf function */
LED_config();
InterruptConfig(); /*设置中断向量起始地址*/
SysTick_Configuration(); /*SysTick配置*/
/* Main loop */
while (1)
{
GPIO_setBit_PD6
Delay(20000);
GPIO_resetBit_PD6
Delay(20000);
printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");
}
}
为什么不能收到串口数据,也不能进行系统滴答实验?串口有占用了系统滴答吗? |