標(biāo)題:
STM32和openmv串口通訊運(yùn)行速度變慢
[打印本頁]
作者:
liuchao626
時(shí)間:
2021-2-17 09:27
標(biāo)題:
STM32和openmv串口通訊運(yùn)行速度變慢
1.使用了仿真器下載程序
2.可以正常收發(fā)數(shù)據(jù)
3.在拔掉openmv串口后,程序起飛,正常運(yùn)行
4插上串口后,一行代碼大概跑0.5秒,屏幕刷新很慢
視頻中黑屏是放下手機(jī)在插線,各位大佬移步觀看視頻(GIF)。
11111.gif
(13.29 MB, 下載次數(shù): 167)
下載附件
2021-2-17 09:26 上傳
作者:
kaixuan_27
時(shí)間:
2021-2-17 09:27
沒有清除串口接收中斷標(biāo)志。
void DEBUG_USART_IRQHandler(void)
{
if(USART_GetITStatus(DEBUG_USARTx,USART_IT_RXNE)!=RESET)
{
temp_head[0] = USART_ReceiveData(DEBUG_USARTx);
}
USART_ClearITPendingBit(DEBUG_USARTx, USART_IT_RXNE);
USART_ClearFlag(DEBUG_USARTx, USART_FLAG_RXNE);
}
作者:
liuchao626
時(shí)間:
2021-2-17 09:34
這是串口中斷
void DEBUG_USART_IRQHandler(void)
{
if(USART_GetITStatus(DEBUG_USARTx,USART_IT_RXNE)!=RESET)
{
temp_head[0] = USART_ReceiveData(DEBUG_USARTx);
}
}
復(fù)制代碼
這是顯示數(shù)據(jù)的代碼
while(1)
{
Gui_DrawFont_GBK16(5,5,BLUE,BLACK,"任務(wù)顯示:");
Gui_DrawFont_GBK16(5,55,BLUE,BLACK,"進(jìn)程:");
Gui_DrawFont_Num32(0 ,20,GREEN,BLACK,Num[2]);
Gui_DrawFont_Num32(0 ,20,BLACK,BLACK,Num[2]);
Gui_DrawFont_Num32(0 ,20,GREEN,BLACK,Num[3]);
Gui_DrawFont_Num32(0 ,20,BLACK,BLACK,Num[3]);
Gui_DrawFont_Num32(0 ,20,GREEN,BLACK,Num[4]);
Gui_DrawFont_Num32(0 ,20,BLACK,BLACK,Num[4]);
Gui_DrawFont_Num32(25,20,GREEN,BLACK,Num[2]);
Gui_DrawFont_Num32(50,20,GREEN,BLACK,Num[3]);
Gui_DrawFont_GBK16(82,30,RED,BLACK,"+");
Gui_DrawFont_Num32(90,20,GREEN,BLACK,Num[1]);
Gui_DrawFont_Num32(115,20,GREEN,BLACK,Num[2]);
Gui_DrawFont_Num32(140,20,GREEN,BLACK,Num[3]);
USART_SendData(DEBUG_USARTx,0xA2);
sprintf((char*)cx_buf,"cx:%08X",temp_head[2]);
Gui_DrawFont_GBK16(5,80,RED,BLACK,cx_buf);
復(fù)制代碼
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1