usart1.c

#include "usart1.h"
#include "usart.h"
#include "string.h"
uint8_t rxflag;
uint8_t rxdata[1];
uint8_t rxindex = 0;
uint8_t rxbuffer[22];

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
		if(huart->Instance==USART1)
		{
			rxbuffer[rxindex++] = rxdata[0];
			HAL_UART_Receive_IT(huart,rxdata,1);
			if(rxindex==22)
			{
				rxflag = 1;
			}
		}

}
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
class="hide-preCode-box">

程序很常规,只有串口那里处理比较麻烦,有几个注意事项

data-report-view="{"mod":"1585297308_001","spm":"1001.2101.3001.6548","dest":"https://blog.csdn.net/Johnor/article/details/136117662","extend1":"pc","ab":"new"}">>
注:本文转载自blog.csdn.net的计算机小混子的文章"https://blog.csdn.net/Johnor/article/details/136117662"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接

评论记录:

未查询到任何数据!