Subversion Repositories Code-Repo

Rev

Rev 150 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 150 Rev 151
Line 12... Line 12...
12
//       the processing of a low priority interrupt.  However, only one of each type
12
//       the processing of a low priority interrupt.  However, only one of each type
13
//       can be processed at the same time.  It is possible to enable nesting of low
13
//       can be processed at the same time.  It is possible to enable nesting of low
14
//       priority interrupts, but this code is not setup for that and this nesting 
14
//       priority interrupts, but this code is not setup for that and this nesting 
15
//       is not enabled.
15
//       is not enabled.
16
 
16
 
17
void interrupt_init() {
17
void Interrupt_Init() {
18
    // Peripheral interrupts can have their priority set to high or low
18
    // Peripheral interrupts can have their priority set to high or low
19
    // Decide on the priority of the enabled peripheral interrupts (0 is low, 1 is high)
19
    // Decide on the priority of the enabled peripheral interrupts (0 is low, 1 is high)
20
 
20
 
21
    // High priority interrupts
21
    // High priority interrupts
22
    IPR1bits.RC1IP = 1;     // USART1 RX interrupt
22
    IPR1bits.RC1IP = 1;     // USART1 RX interrupt
Line 37... Line 37...
37
//    INTCONbits.RBIE = 1;
37
//    INTCONbits.RBIE = 1;
38
    // Enable interrupt for INT1
38
    // Enable interrupt for INT1
39
//    INTCON3bits.INT1IE = 1;
39
//    INTCON3bits.INT1IE = 1;
40
}
40
}
41
 
41
 
42
void interrupt_enable() {
42
void Interrupt_Enable() {
43
    // Peripheral interrupts can have their priority set to high or low.
43
    // Peripheral interrupts can have their priority set to high or low.
44
    // Enable both high-priority interrupts and low-priority interrupts
44
    // Enable both high-priority interrupts and low-priority interrupts
45
    RCONbits.IPEN = 1;
45
    RCONbits.IPEN = 1;
46
    INTCONbits.GIEH = 1;
46
    INTCONbits.GIEH = 1;
47
    INTCONbits.GIEL = 1;
47
    INTCONbits.GIEL = 1;
48
}
48
}
49
 
49
 
50
//int interrupt_in_high_interrupt_routine() {
50
void Interrupt_Disable() {
51
//    return (!INTCONbits.GIEH);
51
    RCONbits.IPEN = 0;
52
//}
-
 
53
//
-
 
54
//int interrupt_low_int_active() {
-
 
55
//    return (!INTCONbits.GIEL);
52
    INTCONbits.GIEH = 0;
56
//}
-
 
57
//
-
 
58
//int interrupt_in_low_interrupt_routine() {
-
 
59
//    if (INTCONbits.GIEL == 1) {
53
    INTCONbits.GIEL = 0;
60
//        return (0);
-
 
61
//    } else if (interrupt_in_high_interrupt_routine()) {
-
 
62
//        return (0);
-
 
63
//    } else {
-
 
64
//        return (1);
-
 
65
//    }
-
 
66
//}
-
 
67
//
-
 
68
//int interrupt_in_main_routine() {
-
 
69
//    if ((!interrupt_in_low_interrupt_routine()) && (!interrupt_in_high_interrupt_routine())) {
-
 
70
//        return (1);
-
 
71
//    } else {
-
 
72
//        return (0);
-
 
73
//    }
-
 
74
//}
54
}
75
 
55
 
76
// Set up the interrupt vectors
56
// Set up the interrupt vectors
77
void InterruptHandlerHigh();
57
void InterruptHandlerHigh();
78
void InterruptHandlerLow();
58
void InterruptHandlerLow();
79
 
59