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

How to measure the frequncy using Timer/counter

hi friends,

I am using the AT91SAM7SE512,

i want to measure the external frequency(1KHz) using the Timer/counter.
I have connected this frequncy to the PIO pin,
The code is
if ( (AT91F_PIO_GetInput(AT91C_BASE_PIOB) & Inputpin ) == 0 ) // count pulse {

if(s==1) { AT91C_BASE_TC0->TC_CCR = (AT91C_TC_CLKEN | AT91C_TC_SWTRG ) ; s=0; } } else {

AT91C_BASE_TC0->TC_CCR = (AT91C_TC_CPCDIS|AT91C_TC_CLKDIS ) ; s=1; value = AT91C_BASE_TC0->TC_CV; print(value); delay(50); }
By using this code i can able to measure only 10Hz.
But i want to measure up to 5KHz.
can you please tell me the procedure to intialise the Timer/counter.

with regards,
Murthy.R

0