interrupt c18
There are two vector interrupt in C18 Compiler.
- One is at 000018:
#pragma code low_vetor=0x18
void interrupt_at_low_vector(void)
{
_asm GOTO low_isr _endasm
}
#pragma code // Return to default code section
- and the other:
#pragma code high_vetor=0x8
void interrupt_at_high_vector(void)
{
_asm GOTO high_isr _endasm
}
#pragma code // Return to default code section
In each vector, you can devide more detail than. (As same as topic was posted above)
Notice: Excepting Privated Flag for each interrrupt, you'll have to turn on Global Flag Interrupt.
Example code:
INTCONbits.TMR0IE = 1; // Enable Timer0
INTCONbits.INT0IE = 0;
INTCONbits.RBIE = 0;
INTCONbits.TMR0IF = 0;
INTCONbits.INT0IF = 0;
INTCONbits.RBIF = 0;
INTCONbits.PEIE = 1; // Enable Peripheral interrupt
INTCONbits.GIE = 1; // Enble Global interrupt
Nop();