//******************************************************************************************* // UART 1 interrupt handler // it is set at priority level 2 //******************************************************************************************* void __ISR(_UART1_VECTOR, ipl2) IntUart1Handler(void) { unsigned char theChar; // Is this an RX interrupt? if (mU1RXGetIntFlag()) { theChar = ReadUART1(); store_char(theChar, &rx_buffer1); // Clear the RX interrupt Flag (must be AFTER the read) mU1RXClearIntFlag(); } // We don't care about TX interrupt if ( mU1TXGetIntFlag() ) { mU1TXClearIntFlag(); } }
//********************************************* //********* UART 1 interrupt handler ********** // Action: Read char received via UART1 //********************************************* void __ISR(_UART1_VECTOR, ipl2) IntUart1Handler(void) { // Is this an RX interrupt? if(mU1RXGetIntFlag()) { // Clear the RX interrupt Flag mU1RXClearIntFlag(); USART_Received_Data = USART_RxData_Reg; // Read received data fUSART_Receive_Set; // Set flag //Return Echo: USART_Received_Data++; USART_Send_Data(USART_Received_Data); } // We don't care about TX interrupt if ( mU1TXGetIntFlag() ) { mU1TXClearIntFlag(); } }