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

LPC 1768 External pulse counting

I want to count external pulses on my LPC 1768 board using any of the 4 Timer/Counters. I am configuring all teh registers but its working in timer mode only but not taking input pulse on one of the capture input. can any body give working code for this.

Regards,

vinay

Parents
  • PINCON->PINSEL3|=(3<<20) // PIN SELECT FOR CAP0.0
    TIM0->TCR = 2; //RESET the timer
    TIM0->CTCR = 1; // CTCR I have configured as counter for CAP0.0 for Timer 0
    TIMO->CCR = 0;
    TIM0->TCR = 1; // Enabling the timer

    Counter_Value = TIM0->TC;

    i am reading Counter_Value.

    by doing this my TC register is counting PCLK instaed of External Clock. is there any mistake in the above code.

    Vinay

Reply
  • PINCON->PINSEL3|=(3<<20) // PIN SELECT FOR CAP0.0
    TIM0->TCR = 2; //RESET the timer
    TIM0->CTCR = 1; // CTCR I have configured as counter for CAP0.0 for Timer 0
    TIMO->CCR = 0;
    TIM0->TCR = 1; // Enabling the timer

    Counter_Value = TIM0->TC;

    i am reading Counter_Value.

    by doing this my TC register is counting PCLK instaed of External Clock. is there any mistake in the above code.

    Vinay

Children