interrupt low_priority
#else
#pragma code
#pragma interruptlow InterruptHandlerLow
#endif
void InterruptHandlerLow() {
    // check to see if we have an interrupt on USART RX
//    if (PIR1bits.RCIF) {
//        PIR1bits.RCIF = 0; //clear interrupt flag
//        uart_recv_int_handler();
//    }

    // check to see if we have an interrupt on timer 1
    if (PIR1bits.TMR1IF) {
        PIR1bits.TMR1IF = 0; //clear interrupt flag
        timer1_int_handler();
    }

    if (PIR1bits.RCIF) {
        PIR1bits.RCIF = 0; //clear interrupt flag
        uart_recv_int_handler();
    }

    // check to see if we have an interrupt on USART TX
    else if (PIR1bits.TXIF) {
        PIR1bits.TXIF = 0;  // Can't clear this directly...
        uart_send_int_handler();
    }

}
示例#2
0
interrupt low_priority
#else
#pragma code
#pragma interruptlow InterruptHandlerLow
#endif

void InterruptHandlerLow() {

    // check to see if we have an interrupt on timer 1
    if (PIR1bits.TMR1IF) {
        PIR1bits.TMR1IF = 0; //clear timer1 interrupt flag
        timer1_int_handler();
    }

    // check to see if we have an interrupt on USART RXF
    if (PIR1bits.RCIF) {
        PIR1bits.RCIF = 0; //clear interrupt flag
        uart_recv_int_handler();
    }

    // check to see if we have an interrupt on USART TXF
    if (PIR1bits.TX1IF && PIE1bits.TX1IE) {
        uart_send_int_handler();
    }
}
示例#3
0
interrupt low_priority
#else
#pragma code
#pragma interruptlow InterruptHandlerLow
#endif


void InterruptHandlerLow() {
    // check to see if we have an interrupt on timer 1
    if (PIR1bits.TMR1IF) {
        PIR1bits.TMR1IF = 0; //clear interrupt flag
        timer1_int_handler();
    }

    // check to see if we have an interrupt on USART RX
 //   if (PIR1bits.RCIF) {
 //       PIR1bits.RCIF = 0; //clear interrupt flag
 //       uart_recv_int_handler();
 //   }

    if (PIR1bits.TXIF && PIE1bits.TXIE) {
        
        uart_tx_int_handler();
        
        

     //   testbuffer = ReadUSART();
    }
}
示例#4
0
interrupt low_priority
#else
#pragma code
#pragma interruptlow InterruptHandlerLow
#endif
void InterruptHandlerLow() {
    // check to see if we have an interrupt on timer 0
    if (INTCONbits.TMR0IF) {
        INTCONbits.TMR0IF = 0; // clear this interrupt flag
        // call whatever handler you want (this is "user" defined)
        timer0_int_handler();
    }

    // check to see if we have an interrupt on timer 1
    if (PIR1bits.TMR1IF) {
        PIR1bits.TMR1IF = 0; //clear interrupt flag
        timer1_int_handler();
    }

    // check to see if we have an interrupt on USART RX
    if (PIR1bits.RCIF) {
//        DEBUG_ON(UART_RX);
        PIR1bits.RCIF = 0; //clear interrupt flag
        uart_recv_int_handler();
//        DEBUG_OFF(UART_RX);
    }
    
    // check to see if we have an interrupt on USART TX
    if (PIR1bits.TXIF && PIE1bits.TXIE) {
//        DEBUG_ON(UART_TX);
        uart_trans_int_handler();
//        DEBUG_OFF(UART_TX);
    }
}
示例#5
0
interrupt low_priority
#else
#pragma code
#pragma interruptlow InterruptHandlerLow
#endif
void InterruptHandlerLow() {
    // check to see if we have an interrupt on timer 1
    if (PIR1bits.TMR1IF) {
        PIR1bits.TMR1IF = 0; //clear interrupt flag
        timer1_int_handler();
    }

    // check to see if we have an interrupt on USART RX
    if (PIR1bits.RCIF) {
        PIR1bits.RCIF = 0; //clear interrupt flag
        uart_recv_int_handler();
    }

    // Check to see if the interrupt flag is high, which means we are able
    // to write data.  Also check if main has enabled the interrupt flag meaning
    // that we actually want to send data.
    if(PIR1bits.TX1IF && PIE1bits.TX1IE)
    {
        uart_send_int_handler();
    }
}
示例#6
0
interrupt
#else
#pragma code
#pragma interrupt InterruptHandlerHigh
#endif
void InterruptHandlerHigh() {

    // We need to check the interrupt flag of each enabled high-priority interrupt to
    // see which device generated this interrupt.  Then we can call the correct handler.


    // check to see if we have an I2C interrupt
    if (PIR1bits.SSPIF) {
        // clear the interrupt flag
        // call the handler
        PIR1bits.SSPIF = 0;
        i2c_int_handler();
    }

    // check to see if we have an interrupt on timer 0
    else if (INTCONbits.TMR0IF) {
        INTCONbits.TMR0IF = 0; // clear this interrupt flag
        // call whatever handler you want (this is "user" defined)
        timer0_int_handler();
    }

#ifdef MASTER_PIC
    if(INTCONbits.INT0IF){
        INTCONbits.INT0IF = 0;
        color_sensor_int_handler();
    }
#endif

    // check to see if we have an interrupt on timer 1
#ifdef MOTOR_PIC
    else if (PIR1bits.TMR1IF) {
        PIR1bits.TMR1IF = 0; //clear interrupt flag
        timer1_int_handler();
    }
#endif
    
#ifdef SENSOR_PIC
    // here is where you would check other interrupt flags.
    if (INTCONbits.INT0IF){
        INTCONbits.INT0IF = 0; // Clear the interrupt flag
        us_int_handler();
    }
#endif

    // The *last* thing I do here is check to see if we can
    // allow the processor to go to sleep
    // This code *DEPENDS* on the code in messages.c being
    // initialized using "init_queues()" -- if you aren't using
    // this, then you shouldn't have this call here

    //SleepIfOkay();
}
示例#7
0
interrupt low_priority
#else
#pragma code
#pragma interruptlow InterruptHandlerLow
#endif
void InterruptHandlerLow() {
    
    #ifdef SENSOR_PIC
    if (PIR1bits.ADIF) {
        PIR1bits.ADIF = 0;
        adc_int_handler();
    }
    #endif //SENSOR_PIC

    // check to see if we have an interrupt on USART RX
    if (PIR1bits.RCIF) {
        PIR1bits.RCIF = 0; //clear interrupt flag

#if !defined(SENSOR_PIC) && !defined(MOTOR_PIC)
        if(wifly_setup){
            uart_recv_int_handler();
        }
        else{
#endif
            uart_recv_wifly_debug_handler();
#if !defined(SENSOR_PIC) && !defined(MOTOR_PIC)
        }
#endif
        
    }
    if (PIR1bits.TXIF)
    {
        PIR1bits.TXIF = 0; // clear interrupt flag
        if (PIE1bits.TXIE)
            uart_send_int_handler();
    }
#ifndef MOTOR_PIC
    if (PIR1bits.TMR1IF) {
        PIR1bits.TMR1IF = 0; //clear interrupt flag
        timer1_int_handler();
    }
#endif

#ifdef SENSOR_PIC
    if (PIR1bits.TMR2IF){
        PIR1bits.TMR2IF = 0; //Clear the interrupt flag
        timer2_int_handler();
    }
#endif
}