HML串口屏发送到单片机 两者互相发送数据及数据解析
char n=0xFF;
void HML_end()
{
int i=3;
while(i–)
printf(&n);
}
void beep_X()
{
BEEP=1; //???
delay_ms(250);
BEEP=0; //???
}
int num = 0;
char *req = NULL;
char numBuf[10];
char *dataPtr = NULL;
unsigned char BUF[USART_REC_LEN]; //½ÓÊÕ»º³å,×î´óUSART_REC_LEN¸ö×Ö½Ú.
void REC_Pro()
{
dataPtr = strchr((const char * )BUF,‘12’); //ËÑË÷’:’
if(dataPtr != NULL) //Èç¹ûÕÒµ½ÁË
{
dataPtr++;
Led4_Set(LED_ON);
Led5_Set(LED_ON);
while(*dataPtr >= '0' && *dataPtr <= '9') //ÅжÏÊÇ·ñÊÇÏ·¢µÄÃüÁî¿ØÖÆÊý¾Ý
{
numBuf[num++] = *dataPtr++;
}
numBuf[num] = 0;
num = atoi((const char *)numBuf); //תΪÊýÖµÐÎʽ
if(strstr((char *)(const char * )BUF, "12")) //ËÑË÷"redled"
{
if(num == 3) //¿ØÖÆÊý¾ÝÈç¹ûΪ1£¬´ú±í¿ª
{
//beep_X();
}
else if(num == 5) //¿ØÖÆÊý¾ÝÈç¹ûΪ0£¬´ú±í¹Ø
{
//Led4_Set(LED_OFF);
beep
本文地址:https://blog.csdn.net/weixin_43481450/article/details/107994034