main(void) { /* PC4 PC13
PB10
PA0 */ USART_InitTypeDef USART_InitStructure; USART_InitStructure.USART_BaudRate = 9600; 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;
USART_ITConfig(USART2,USART_IT_RXNE,ENABLE);
STM_EVAL_COMInit(COM2, &USART_InitStructure);
USART_Cmd(USART2,ENABLE);}
stm32f10x_it.c
void USART2_IRQHandler(void) { u16 c; if (SET == USART_GetFlagStatus(USART2, USART_FLAG_RXNE)) { c = USART_ReceiveData(USART2); USART_SendData(USART2, c); //GPIOD->ODR=0xffff; printf("ddddeeee"); while (RESET == USART_GetFlagStatus(USART2, USART_FLAG_TC)); } }
为什么不进入中断啊 我将程序下载到flash中用 串口调试助手发数据的
|