0
votes

When I try to compile the code for a PIC program using PICMicro C compiler, I got the error "incomplete type is not allowed" for the interrupt service routine part of the code:

char chB = 0;
int clicks = 0;
void interrupt ISR(void) //incomplete type is not allowed
{
    if(RBIF == 1)
    {
        clicks++;
        chB = PORTB;
        RBIF = 0;
    }
}

After checking multiple sources, I still do not see how the service routine is incorrectly written..

Edit: Thanks for all your help, I have found the solution:

char chB = 0;
int clicks = 0;
#pragma vector = 0x04
__interrupt void isr(void)
{
    if(RBIF == 1)
    {
        clicks++;
        chB = PORTB;
        RBIF = 0;
    }
}
2
If you're using GCC, try with void __attribute__ ((interrupt)) ISR(void)Jigsore
I suspect the ISR identifier is a macro that requires an ISR name...user529758
@H2CO3 the ISR identifier is a random function name. I changed to other names and it still is not working..staca
@Jigsore Sorry, I forgot to mention I am using the PICMicro C compiler so I just edited my post. I tried it but now the compiler states "expected a type specifier", "unnamed prototyped parameters not allowed when body is present", "expected a "{"".staca

2 Answers

1
votes

"interrupt ISR" is not a valid name, because it has a space in it. void interrupt_isr(void) should be fine.

0
votes

For PIC16xxx family MCUs use this form:

void interrupt () {

  } // end interrupt