Page 1 of 1

Problems with compiling interrupt routine with XC8

PostPosted: Sat Jan 05, 2019 6:27 pm
by Andrea9765
Hello, I'm trying to compile a project for PIC16F887 with XC8, this routine gives me some problems:

void interrupt isr(void)
{
if (SSPIF)
{
SSPIF = 0;
isrEnd = 1;
}
}

This is the error that the compiler gives me:

make[2]: *** [build/default/production/main.p1] Error 1
main.c:36:6: error: variable has incomplete type 'void'
void interrupt isr(void)
make[1]: *** [.build-conf] Error 2
^
make: *** [.build-impl] Error 2
main.c:36:15: error: expected ';' after top level declarator
void interrupt isr(void)
^
;
2 errors generated.
(908) exit status = 1

Anybody can help me ? Thanks very much

Re: Problems with compiling interrupt routine with XC8

PostPosted: Mon Jan 07, 2019 12:32 am
by ric
Which version XC8 are you using?
If it is XC8 v2.0, which mode? (C90 or C99?)

Re: Problems with compiling interrupt routine with XC8

PostPosted: Sat Jan 19, 2019 9:19 am
by Rusettsten
You need to make the interrupt to be "void __interrupt() ISR (void)"

Re: Problems with compiling interrupt routine with XC8

PostPosted: Sat Jan 19, 2019 9:24 am
by ric
Rusettsten wrote:You need to make the interrupt to be "void __interrupt() ISR (void)"

That's true if they are using C99 mode, hence my questions in the previous post, which are still unanswered.