We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
hi friend , thanks for your suggestion, Here is the code
if((AT91F_PIO_GetInput(AT91C_BASE_PIOB)&Inputpin )==0) { 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); }