This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CC1_CC8IC interrupt

Hello
can someone tell me why my interrupt does not respond, with the debugger, I always get z = 0

double z;

main {
.
.
.
.
.
.

while(1)
 {
CC1_M2      =  0x0001;//  001=>capture on posirtive Flanke
CC1_T01CON  =  0x0047;
CC1_CC8IC   =  0x00C0; // Interrupt enable und
z = Periode ;
 }//end of while
 }// end of main


 void Drehzahl_messung(void) interrupt(0x18)
  {

Periode = 100;
  }


or what I have since forgotten
Thanks

Parents
  • I see a couple of things.

    Your interrupt priority is on level zero which will never allow it to vector so you need to move it off of zero.

    Secondly I didn't see where you globally enabled interrupts?

    Thirdly, not sure of the code sequence but if you are looking for a interrupt on the rising edge of P2.8 then here is your example slightly modified.

    #include <xc167.h>
    double z;
    double Periode;
    
    void main (void) {
      CC1_M2      =  0x0001;//  001=>capture on posirtive Flanke
      CC1_T01CON  =  0x0047;
      CC1_CC8IC   =  0x0044; // Interrupt enable und, ILVL = 1
      PSW_IEN = 1; // globally enable interrupts
      while(1)
     {
      z = Periode ;
     }//end of while
    }// end of main
    
    
    void Drehzahl_messung(void) interrupt(0x18) {
      Periode = 100;
    }
    

    Hope this helps

Reply
  • I see a couple of things.

    Your interrupt priority is on level zero which will never allow it to vector so you need to move it off of zero.

    Secondly I didn't see where you globally enabled interrupts?

    Thirdly, not sure of the code sequence but if you are looking for a interrupt on the rising edge of P2.8 then here is your example slightly modified.

    #include <xc167.h>
    double z;
    double Periode;
    
    void main (void) {
      CC1_M2      =  0x0001;//  001=>capture on posirtive Flanke
      CC1_T01CON  =  0x0047;
      CC1_CC8IC   =  0x0044; // Interrupt enable und, ILVL = 1
      PSW_IEN = 1; // globally enable interrupts
      while(1)
     {
      z = Periode ;
     }//end of while
    }// end of main
    
    
    void Drehzahl_messung(void) interrupt(0x18) {
      Periode = 100;
    }
    

    Hope this helps

Children
No data