void __irq UART0_Exception(void) { static uint8 IIR,temp; static uint8 i = 0; static volatile uint8 rcv_buf[23]; static uint8 revstart = FALSE; while(((IIR = U0IIR) & 0x01) == 0) //有中断未处理完 { switch (IIR & 0x0e) { case 0x02: //THRE中断 break; case 0x04: temp = U0RBR; if(temp == '@') { revstart = TRUE; } if( revstart == TRUE ) { rcv_buf = temp; i++; if(passflag == FALSE) { if(i>=7) { if((rcv_buf[1]=='D')&&(rcv_buf[2]=='E')&&(rcv_buf[3]=='C')) { passflag = TRUE; } for( i = 0;i < 7 ; i++ ) { rcv_buf = '0'; } i = 0; } } else {........... .............} break; case 0x06: temp = U0LSR; break; //接收线状态 case 0x0c: //字符超时指示 break; default : break; } } VICVectAddr = 0; // 通知中断控制器中断结束 } |