第一次发送:K2345678901234567890123456789012345678901234567890123456789B第一次接收:空K2345678901234567890123456789012345678901234567890123456789 第二次发送:A2345678901234567890123456789012345678901234567890123456789L第二次接收:BA2345678901234567890123456789012345678901234567890123456789
void USART3_IRQHandler(void){ u8 Res; if((__HAL_UART_GET_FLAG(&USART3_Handler,UART_FLAG_RXNE)!=RESET)) { HAL_UART_Receive(&USART3_Handler,&ch3,1,10);// if(ch3 != 0 || z != 0) temp_data[z ++] = ch3; if(z == 60) { usart3_send_bytes(temp_data,60);// memcpy(wifi_down_data,temp_data,z); memset(temp_data,0,sizeof(temp_data)); z = 0; wifi_order_come_flag = 1; } // HAL_UART_IRQHandler(&USART3_Handler);// while (HAL_UART_GetState(&USART3_Handler) != HAL_UART_STATE_READY);//μè′y¾íD÷ while(HAL_UART_Receive_IT(&USART3_Handler, (u8 *)&ch3, 1) != HAL_OK); }
}
USART3_Handler.Instance=USART3; //USART3 USART3_Handler.Init.BaudRate=bound; //2¨ìØÂê USART3_Handler.Init.WordLength=UART_WORDLENGTH_8B; USART3_Handler.Init.StopBits=UART_STOPBITS_1; USART3_Handler.Init.Parity=UART_PARITY_NONE; USART3_Handler.Init.HwFlowCtl=UART_HWCONTROL_NONE; USART3_Handler.Init.Mode=UART_MODE_TX_RX; // __HAL_UART_DISABLE_IT(&USART3_Handler,UART_IT_TC); __HAL_UART_ENABLE_IT(&USART3_Handler,UART_IT_RXNE); HAL_NVIC_EnableIRQ(USART3_IRQn); HAL_NVIC_SetPriority(USART3_IRQn,3,3); HAL_UART_Init(&USART3_Handler);
HAL_UART_Receive_IT(&USART3_Handler, (u8 *)&ch3, 1);
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>