Skip to main content
Added info for high priority interrupts
Source Link
user17592
user17592

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide:

MPLAB C18 does not automatically place an ISR at the interrupt vector. Commonly, a GOTO instruction is placed at the interrupt vector for transferring control to the ISR proper. For example:

void lowPriorityISR(void);

#pragma code low_vector=0x18
void interrupt_at_low_vector(void) { 
    _asm GOTO lowPriorityISR _endasm 
}
#pragma code

#pragma interruptlow lowPriorityISR
void lowPriorityISR() {
}

When implementing a high priority ISR, you cannot use the interrupthigh pragma as you would expect. You'll have to use the interrupt pragma instead, as is described here.

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide:

MPLAB C18 does not automatically place an ISR at the interrupt vector. Commonly, a GOTO instruction is placed at the interrupt vector for transferring control to the ISR proper. For example:

void lowPriorityISR(void);

#pragma code low_vector=0x18
void interrupt_at_low_vector(void) { 
    _asm GOTO lowPriorityISR _endasm 
}
#pragma code

#pragma interruptlow lowPriorityISR
void lowPriorityISR() {
}

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide:

MPLAB C18 does not automatically place an ISR at the interrupt vector. Commonly, a GOTO instruction is placed at the interrupt vector for transferring control to the ISR proper. For example:

void lowPriorityISR(void);

#pragma code low_vector=0x18
void interrupt_at_low_vector(void) { 
    _asm GOTO lowPriorityISR _endasm 
}
#pragma code

#pragma interruptlow lowPriorityISR
void lowPriorityISR() {
}

When implementing a high priority ISR, you cannot use the interrupthigh pragma as you would expect. You'll have to use the interrupt pragma instead, as is described here.

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

Added code & removed manual screenshot
Source Link

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide (sorry for the screenshot, but I can't copy&paste from the pdf): enter image description here

MPLAB C18 does not automatically place an ISR at the interrupt vector. Commonly, a GOTO instruction is placed at the interrupt vector for transferring control to the ISR proper. For example:

void lowPriorityISR(void);

#pragma code low_vector=0x18
void interrupt_at_low_vector(void) { 
    _asm GOTO lowPriorityISR _endasm 
}
#pragma code

#pragma interruptlow lowPriorityISR
void lowPriorityISR() {
}

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide (sorry for the screenshot, but I can't copy&paste from the pdf): enter image description here

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide:

MPLAB C18 does not automatically place an ISR at the interrupt vector. Commonly, a GOTO instruction is placed at the interrupt vector for transferring control to the ISR proper. For example:

void lowPriorityISR(void);

#pragma code low_vector=0x18
void interrupt_at_low_vector(void) { 
    _asm GOTO lowPriorityISR _endasm 
}
#pragma code

#pragma interruptlow lowPriorityISR
void lowPriorityISR() {
}

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

added 110 characters in body
Source Link
m.Alin
  • 10.8k
  • 20
  • 65
  • 89

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide (sorry for the screenshot, but I can't copy&paste from the pdf): enter image description here

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide (sorry for the screenshot, but I can't copy&paste from the pdf): enter image description here

You'll find the information you need in the compiler's manual: MPLAB C18 C COMPILER USER'S GUIDE.

From page 37 of the user's guide (sorry for the screenshot, but I can't copy&paste from the pdf): enter image description here

If you can change the compiler: using interrupts is easier in the Microchip XC8 or HI-TECH PICC compilers.

Source Link
m.Alin
  • 10.8k
  • 20
  • 65
  • 89
Loading