Esempio n. 1
0
__interrupt void USCIAB0RX_ISR(void)
{
  if (IFG2 & UCA0RXIFG)                   //If received an USCIA0 RX interrupt
  {
    debugConsoleIsr(UCA0RXBUF);         //Call the function. Reading this register clears the interrupt flag
  } 
  if (UCB0STAT & UCNACKIFG)               //If I2C bus received a NACK...
  {                                     
    UCB0CTL1 |= UCTXSTP;                // ... then send a STOP
    UCB0STAT &= ~UCNACKIFG;             // and clear the status bit.
  }
}
/**
 Debug console interrupt service routine, called when a byte is received on UART.
 @pre In startup_ccs.c, UARTIntHandler is set as the ISR for the UART0 Rx and Tx interrupt
 @pre In startup_ccs.c, this function is declared, e.g:
 <pre>
 extern void UARTIntHandler(void);
 </pre>
 @pre Interrupts have been enabled, e.g:
 <pre>
 IntMasterEnable();
 IntEnable(INT_UART0);
 UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
 </pre>
 @pre UART has been configured
 @post a byte received on the UART will result in debugConsoleIsr() function pointer called
 */
void UARTIntHandler(void)
{
    unsigned long ulStatus;

    // Get the interrupt status.
    ulStatus = UARTIntStatus(UART0_BASE, true);

    // Clear the asserted interrupts.
    UARTIntClear(UART0_BASE, ulStatus);

    // Loop while there are characters in the receive FIFO.
    while(UARTCharsAvail(UART0_BASE))
    {
        // Read the next character from the UART
    	uint8_t c = (uint8_t) UARTCharGetNonBlocking(UART0_BASE);
        debugConsoleIsr(c);    // call the function pointer
    }
}
Esempio n. 3
0
/**
 Debug console interrupt service routine, called when a byte is received on UART.
 @pre In startup_ccs.c, UARTIntHandler is set as the ISR for the UART0 Rx and Tx interrupt
 @pre In startup_ccs.c, this function is declared, e.g:
 <pre>
 extern void UARTIntHandler(void);
 </pre>
 @pre Interrupts have been enabled, e.g:
 <pre>
 IntMasterEnable();
 IntEnable(INT_UART0);
 UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
 </pre>
 @pre UART has been configured
 @post a byte received on the UART will result in debugConsoleIsr() function pointer called
 */
void UARTIntHandler(void)
{
    toggleLed(4);
    //printf("$");
    unsigned long ulStatus;

    // Get the interrupt status.
    ulStatus = UARTIntStatus(UART0_BASE, true);

    // Clear the asserted interrupts.
    UARTIntClear(UART0_BASE, ulStatus);

    // Loop while there are characters in the receive FIFO.
    while(UARTCharsAvail(UART0_BASE))
    {
        // Read the next character from the UART and write it back to the UART.
        uint8_t c = (uint8_t) UARTCharGetNonBlocking(UART0_BASE);
        debugConsoleIsr(c);    //reading this register clears the interrupt flag
    }
}