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.

Problem timer0 interrupt PIC18F4550

Status
Not open for further replies.

yamine

Member level 1
Joined
May 4, 2012
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,507
Hello everybody; i neeeeeeeed your help please !
this is my program :

Code:
 /** INCLUDES *******************************************************/
#include <p18cxxx.h>
#include "bootloader.h"
void low_ISR (void);
void YourLowPriorityISRCode(void);

#pragma code low_vector = 0x18
void low_ISR (void)
{
_asm goto YourLowPriorityISRCode _endasm
}

#pragma code
#pragma interruptlow YourLowPriorityISRCode
void YourLowPriorityISRCode(void)
{
	INTCONbits.TMR0IF 	= 0;  //Clear Timer 0 Interrupt Flag
	LATBbits.LATB0 	=!(LATBbits.LATB0) ;  //inverse the output
}



/** Ports Init ******************************************/
void Init_Portb(void)
{
	TRISBbits.TRISB0 = 0; 	//RB0 = output
	LATBbits.LATB0 	= 0;
	
}

/** TIMER0 Init ******************************************/
void EnableTimer (void)
{		
	TMR0H = 0x00;
	TMR0L = 0x00;
	T0CON = 0x01;  	// Timer disabled; prescalar of 1:4; 16 bit mode 		  		
	RCONbits.IPEN 		= 1;	//Enable Interrupt Priorities
	INTCONbits.GIEL 	= 1; 	//Enable Low Priority Interrupt
	INTCONbits.GIE 		= 1; 	//Enable GlobalInterrupt			  
	INTCONbits.TMR0IE 	= 1;	//Enable Timer0 Interrupt
	INTCON2bits.TMR0IP	= 0;	//TMR0 set to Low Priority Interrupt
	T0CONbits.TMR0ON = 1; //Start Timer0
}

/** MAIN Programm *************************************************/
void main(void)
{
	Init_Portb();
	EnableTimer();
	while(1);	
}

this is the error after compilation (with MPLAB v8.84, et MPLABC v3.41) ;
Error - could not find definition of symbol 'YourHighPriorityISRCode' in file './main.o'.


please help me !
 

Thank you for the answer,
i read this articles, i have include all necessary files "bootloader, linker " but the problem is the same !
 

hello

you are not using same label for interrupt ?
low_vector & low_ISR

Code:
#pragma code low_vector = 0x18
void low_ISR (void)
{
_asm goto YourLowPriorityISRCode _endasm
}
 

thank you paulfjujo for your remark, i change the label names, and this is the error message :

Error - could not find definition of symbol 'YourHighPriorityISRCode' in file './main.o'.

Please help me!
 

thank you paulfjujo for your remark, i change the label names, and this is the error message :

Error - could not find definition of symbol 'YourHighPriorityISRCode' in file './main.o'.

Please help me!

Your compiler/linker is saying that it can't find the function "YourHighPriorityISRCode" anywhere (in the object files you used, or in the library you're pulling in during the link phase).

1) make sure the function name is correct, ie no typographical errors
2) try to find who find the definition of "YourHighPriorityISRCode" in your source and check if it is being conditionally compiled, ie the code is inside a #ifdef
 
  • Like
Reactions: yamine

    yamine

    Points: 2
    Helpful Answer Positive Rating
hello

if you have a bootloader, maybe the (user) interrupt vectors arent displaced in another area...
 
  • Like
Reactions: yamine

    yamine

    Points: 2
    Helpful Answer Positive Rating
Thank you,
BUILD SUCCEEDED !

*********** BUT my program go into interrupt subroutine just one time !
i don't know what is the problem again !
 
Last edited:

hello



in the interrupt routine you don't reinitialise the timer.
and it's better to RAZ the flag just before leaving the interupt

try this


Code:
void YourLowPriorityISRCode(void)
{
	
	LATBbits.LATB0 	=! LATBbits.LATB0 ;  //inverse the output
        TMR0H = 0x00;
	TMR0L = 0x00;
        INTCONbits.TMR0IF 	= 0;  //Clear Timer 0 Interrupt Flag
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top