Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 26, 2024, 10:32:13 10:32


Login with username, password and session length


Pages: [1]
Print
Author Topic: Problem on RB0 interrupt in HT-PICC  (Read 14935 times)
0 Members and 2 Guests are viewing this topic.
arash
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 2
-Receive: 0


« on: February 08, 2006, 07:53:43 07:53 »

Hi guys.
I've problem on RB0 interrupt in HT-PICC.I use the PICC "interruptDemo" sample.

static void interrupt
isr(void){
 if(INTF) {
  INTF = 0;
 }
}

But mplab says:
Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 364 : multiply defined symbol "int_func"

Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 387 : multiply defined symbol "saved_w"

Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 393 : multiply defined symbol "int_restore"

Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 402 : multiply defined symbol "int_entry"

Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 408 : multiply defined symbol "saved_status"

Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 411 : multiply defined symbol "saved_pclath"

I culdent find even one "saved_w" but it says "multiply defined symbol"

Whats my wrong?
Logged
vsmvdd
Junior Member
**
Offline Offline

Posts: 92

Thank You
-Given: 1
-Receive: 25


« Reply #1 on: February 08, 2006, 12:49:27 12:49 »

Quote from: arash
Hi guys.
I've problem on RB0 interrupt in HT-PICC.I use the PICC "interruptDemo" sample.
 
static void interrupt
isr(void){
if(INTF) {
INTF = 0;
}
}
 
But mplab says:
Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 364 : multiply defined symbol "int_func"
 
Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 387 : multiply defined symbol "saved_w"
 
Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 393 : multiply defined symbol "int_restore"
 
Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 402 : multiply defined symbol "int_entry"
 
Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 408 : multiply defined symbol "saved_status"
 
Error[845] C:\DOCUME~1\Arash\LOCALS~1\Temp\s7o. 411 : multiply defined symbol "saved_pclath"
 
I culdent find even one "saved_w" but it says "multiply defined symbol"
 
Whats my wrong?

 
 
i dont think you grasp interrupts well
you cannot static void an interupt service routine in c
you must 'define it ' instead  as a void
like this
 
#int_default
default_isr()
{
}
#INT_TIMER1
void Timer1Interrupt (void)
{
}
#INT_RTCC
void Timer0Interrupt (void)
{
}
#INT_AD
void AdcInterrupt (void)
{
}
 
 
look for further examples here http://www.microchipc.com/
Logged
sam_des
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 128
-Receive: 151


« Reply #2 on: February 08, 2006, 07:15:50 19:15 »

Hi arash ,
   I guess, you have more than one functions as interrupt handler...
   In HT-PICC, there can be only one function with modifier "interrupt". If you want
seperate handler for each interrupt source you can call the your handler from
one "interrupt" function. I'll give examples ...
 
   1] One single Interrupt function servicing more than one Interrupt Source

              static interrupt void ServeInt(void)
              {
                   // compiler automatically saves context (W, STATUS, PCLATCH, FSR)
                  if(INTF)                   // external interrupt
                  {
                       INTF = 0;  // clear flag
                       // your code
                  }
                  if(TMR2IF)              // timer2 overflow interrupt
                 {
                      TMR2IF = 0; // clear flag
                      // your code
                 }
                 // other interrupts
                 // compiler automatically restores context
              } // return from interrupt

     2] Seperate Interrupt Handlers :-
               void ServeINTF(void)                  // external interrupt handler
               {  INTF = 0;  /* other code */ }
               
               void ServeTMR(void)                   // timer2 overlfow interrupt handler
               {  TMR2IF = 0;  /* other code  */ }

               static interrupt void ServeInt(void) // central "interrupt" handler
               {
                      // context save
                      if(INTF)  { ServeINTF(); }
                      if(TMR2IF) { ServeTMR2(); }
                      // other interrupts
                      // context restore
                }// return from interrupt

    Only care one has to take is about "hardware stack overflow".
    Also second method requires more code & more time to execute due to function calls.

     saved_status, saved_w etc. are the compiler defined context saving registers. You can check that with "map" & "lst"  files for your project.

    So you can have "static" modifier too. By the way "static" modifier can applied to any function in "c" to limit it's scope to current module, so that it can't called from other modules even with "extern" modfier.

    I think I've made it pretty clear. Well, Let me know if you require more clarification.

_Sam
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
arash
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 2
-Receive: 0


« Reply #3 on: February 08, 2006, 08:27:19 20:27 »

Thanks
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC