Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Compiler Error C18 for PIC18f

Status
Not open for further replies.

sukhavsa

Newbie level 6
Joined
Nov 14, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,390
Hi

I have been using the MPLAB C18 for PIC18F8722.

I am stuck with this compiler error since morning
" Error [1111] undefined label 'ISR' in 'InterruptVector'"

here is the part of my code that involves interrupts.

/** I N T E R R U P T S **********************************************/
#pragma code InterruptVector = 0x08
void InterruptVector (void)
{
_asm
goto ISR
_endasm
}

/******** Interrupt Service Routines *************************/
#pragma interrupt ISR
void ISR (void)
{
// Check to see if TMR3 overflow caused the interrupt
int ADCvalue;
if (PIR2bits.TMR3IF)
{
ADCvalue = ADC_module();
}
}

Previously I was polling for TMR3 overflow everything was working fine and now i changed it into an ISR and it doesnt even compile.

I dont know why this error is coming up, the labels are obviously same.
This seems very trivial but i cant see anything wrong.
Please help me figure it out, I would really appreciate it.

Thanks
 

You need to put the function prototype at the beginning of the file.

void ISR (void);
 

    sukhavsa

    Points: 2
    Helpful Answer Positive Rating
I did declare the isr prototype along with the other functions at the beginning, but still the error sustained.
This is so annoying as i cannot see anything wrong. any suggestions would help a lot.
Thanks
 

Hi,
Try this:
Code:
void InterruptVector(void);
void ISRT(void);

/** I N T E R R U P T S **********************************************/
#pragma code InterruptVector = 0x08
void InterruptVector (void)
{
_asm GOTO ISR _endasm
}

/******** Interrupt Service Routines *************************/
#pragma code
#pragma interrupt ISR
void ISR (void)
{
// Check to see if TMR3 overflow caused the interrupt
int ADCvalue;
if (PIR2bits.TMR3IF)
{
ADCvalue = ADC_module();
}
}

Hope this helps.
Tahmid.
 

    sukhavsa

    Points: 2
    Helpful Answer Positive Rating
@Tahmid and btbass

Your suggestion helped.
I was declaring the prototypes before main and after defining the interrupt vectors.
Now i did the way you suggested exactly, declaring prototypes before the interrupt definition and the error is gone.

Thanks a bunch.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top