1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
那你仿真看一下,加了串口3之后程序跑哪去了
|
|
|
|
尽量精简串口中断服务函数的代码
|
|
|
|
void USART2_IRQHandler(void) //串口2接收中断入口函数 { static int ucRxCnt = 0; OSIntEnter(); USART_ClearFlag(USART2,USART_FLAG_TC); if(USART_GetITStatus(USART2,USART_IT_RXNE)!=Bit_RESET) { USART_ClearFlag(USART2,USART_IT_RXNE); ucRxBuffer[ucRxCnt++] = USART_ReceiveData(USART2); if(ucRxCnt== 32) { OSQPost(PM25_MsgQueue, (void*)ucRxBuffer); ucRxCnt = 0; delay_ms(100); } } OSIntExit(); } void USART3_IRQHandler(void) //串口3中断入口函数 { u8 Res=0; OSIntEnter(); Res =USART_ReceiveData(USART3); Uart3_Buf[First_Int] = Res; //将接收到的字符串存到缓存中 First_Int++; //缓存指针向后移动 if(First_Int > Buf3_Max) //如果缓存满,将缓存指针指向缓存的首地址 { First_Int = 0; } OSIntExit(); } void TIM2_IRQHandler(void) //定时器2中断入口函数 { static u8 flag =1; OSIntEnter(); if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) //检查TIM2更新中断是否发生 { TIM_ClearITPendingBit(TIM2, TIM_IT_Update ); //清除TIMx中断标志位 if(Timer0_start) Times++; if(Times > shijian) { Timer0_start = 0; Times = 0; } if(flag) { flag=0; } else { flag=1; } } OSIntExit(); } void Second_AT_Command(char *b,char *a,u8 wait_time) { u8 i; char *c; c = b; //保存字符串地址到c CLR_Buf3(); i = 0; while(i == 0) { if(!Find(a)) { if(Timer0_start == 0) { b = c; //将字符串地址给b for (; *b!=' |