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

INFINEON c517 MICROCONTROLLER

I want to use external interrupts on Pin P1.2 & p1.3 for frequancy measurement
When Positive transition occours on pin External interrupt should be occour
And in interrupt vector I want to increment one count
time base is generated by timer 0 for ).1 seconds.

My probelm is even thouh frquancy of 1 Khz is applied to Pin P1.2 interrupt is not generate.

I want to know regisier detail configurations of resigistrs so that externl interrupt will generate

  • Positive transition occours on pin External interrupt should be occour

    Ignorance of the hardware is no excuse, it's "bible time"

    Erik

    here are the links to "the bible"
    Chapter 1 - 80C51 Family Architecture:
    www.nxp.com/.../80C51_FAM_ARCH_1.pdf

    Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set:
    www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf

    Chapter 3 - 80C51 Family Hardware Description:
    www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf

  • You don't have to set much to get the interrupts.

    Here is some very basic code.

    #include <reg517a.h>
    
    volatile char events_cc2;
    volatile char events_cc3;
    
    void T2_CC2(void) interrupt 12 {
      events_cc2++;
    }
    
    void T2_CC3(void) interrupt 13 {
      events_cc3++;
    }
    
    void main(void) {
    
      EAL    = 1;    /* globally enable interrupts    */
      T2CON |= 0x11; /* timer with auto-reload        */
      EX5    = 1;    /* CC2/ext5 interrupt is enabled */
      EX6    = 1;    /* CC3/ext6 interrupt is enabled */
    
      /* Capture on positive transition at pin P1.3/CC3
       * Capture on positive transition at pin P1.2/CC2
       */
      CCEN = 0x50;
    
      for(;;) {
      }
    }
    

  • Thanks for your reply.

    My hardware is perfect because if i measure the freqauncy by polling port pin for 0.1 sec using timer 1 it shows (for 1Khz it show 100 count = 0.1 sec time base.)
    Frequancy present at one i/p at time. so f_counter one variable is used for both.
    timer 1 is used for 0.1 sec time base code is not added here to make it small to read
    My code is something like this

    P1_2 |=1; //frequancy i/p 1 (Rotor 1/INT 5/cc2)
    P1_3 |=1; //frequancy i/p 2 (Rotor 2 inpINT 6/cc3)
    T2CON |=0x11; //|=b00010001; f oscilator/12
    CTCON |=b00000000//msb bits of T2CON & CTCON
    EX5=1; //enable ext int 5, P1_2
    EX6=1; //enable ext int 6, P1_3
    EN2 |= b00111100; //CCU int enable bits
    EAL=1; //enable global int
    CCEN =0x50; //cap on rising edge p1.3 & p1.2)
    //CMSEL =0xff;

    for ( ; ; ) { _SRVWDT(); //watchdog

    //*****scratch pad trial code******
    SET_CURSOR (1,0);
    DISP_STRING ("= ",0);
    DISP_DEZ(f_counter,5,0); //Display freq dec. form
    }

    //**************************************************** void EXT5_int (void) interrupt 12 //using 2 { f_counter=f_counter+1; }
    //**************************************************** void EXT6_int (void) interrupt 13 //using 2 { f_counter=f_counter+1; }

    //****************************************************