void USART1_IRQHandler(void) //´®¿Ú1ÖжϷþÎñ³ÌÐò { u8 Res; #ifdef OS_TICKS_PER_SEC //Èç¹ûʱÖÓ½ÚÅÄÊý¶¨ÒåÁË,˵Ã÷ҪʹÓÃucosIIÁË. OSIntEnter(); #endif if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) //½ÓÊÕÖжÏ(½ÓÊÕµ½µÄÊý¾Ý±ØÐëÊÇ0x0d 0x0a½áβ) { Res =USART_ReceiveData(USART1);//(USART1->DR); //¶ÁÈ¡½ÓÊÕµ½µÄÊý¾Ý if(Res==0x31) { //LED0ÉÁÒ»´Î LED0 = ; delay_ms(); LED0 = ; delay_ms(); LED0 = ; delay_ms(); LED0 = ; } //LED1 ÁÁ if(Res==0x32) { LED1 = ; } )//½ÓÊÕδÍê³É { if(USART_RX_STA&0x4000) //½ÓÊÕµ½ÁË0x0d { ;//½ÓÊÕ´íÎó,ÖØпªÊ¼ else USART_RX_STA|=0x8000; //½ÓÊÕÍê³ÉÁË } else //»¹Ã»ÊÕµ½0X0D { if(Res==0x0d)USART_RX_STA|=0x4000; else { USART_RX_BUF[USART_RX_STA&0X3FFF]=Res ; USART_RX_STA++; ))USART_RX_STA=;//½ÓÊÕÊý¾Ý´íÎó,ÖØпªÊ¼½ÓÊÕ } } } }
) { if(USART_RX_STA&0x8000) { len=USART_RX_STA&0x3fff;//µÃµ½´Ë´Î½ÓÊÕµ½µÄÊý¾Ý³¤¶È printf("\r\nÄú·¢Ë͵ÄÏûϢΪ:\r\n\r\n"); ;t<len;t++) { USART_SendData(USART1, USART_RX_BUF[t]);//Ïò´®¿Ú1·¢ËÍÊý¾Ý while(USART_GetFlagStatus(USART1,USART_FLAG_TC)!=SET);//µÈ´ý·¢ËͽáÊø } printf("\r\n\r\n");//²åÈë»»ÐÐ USART_RX_STA=; } else { times++; ==)printf("\r\nѧºÅ:14160310317ÐÕÃû:ÕÔ´æµµ µÈ´ýKEY0 KEY1 ±»°´ÏÂ\r\n"); delay_ms(); t=KEY_Scan(); if(t) { switch(t) { case KEY_UP: printf("\r\nKEY0±»°´ÏÂ\r\n\r\n"); break; case KEY_LEFT: BEEP=; delay_ms(); BEEP=; break; } } } }