//使用串口中断控制 ***_it.c extern uint8_t recivedatass; void USART1_IRQHandler(void) { HAL_UART_IRQHandler(&huart1); HAL_UART_Receive_IT(&huart1,&recivedatass,1); printf("int:rcv=%d\r\n",recivedatass); } main.c main() { ... while (1) { if(recivedatass==65) { MC_StopMotor1(); printf("exec stop motor \r\n"); recivedatass=0; } if(recivedatass==66) { printf("exec before start motor\r\n"); MC_StartMotor1(); printf("exec after start motor\r\n"); recivedatass=0; } } } |
评分
查看全部评分
在检测一下串口收发正常不
评分
查看全部评分
评分
查看全部评分