Hi Everyone
Platform:LPC844M201JHI33
Software:LPC845-Example-Code-Bundle-MCUXpresso
Main clock:30MHz
We would like implement capture function of CTimer, but we are encountering some problems.
1. use a signal generator to generate a signal(20Hz, 20 high pulse per second)
2. setup PR(Prescale register)=1(15MHz), the TC(Timer Counter) only report 10 time per second.
3. setup PR(Prescale register)=0(30MHz), the TC(Timer Counter) report 20 time per second.
4. setup PR(Prescale register)=29(1MHz), the TC(Timer Counter) no any response.
input frequency is low, why must use a high frequency PR setting be used to calculate the correct number of pulses?
why use capture channel 0, the CR0 can't read any value? only TC(Timer Counter) have increase numbers, what function for CR0~3?
Thanks.
Solved! Go to Solution.
Hello @Felix_ar
Each capture register is associated with one capture channel and may be loaded with the
counter/timer value when a specified event occurs on the signal defined for that capture
channel.
BR
Alice
Hello @Felix_ar
Each capture register is associated with one capture channel and may be loaded with the
counter/timer value when a specified event occurs on the signal defined for that capture
channel.
BR
Alice
Hi Alice
Thank for you reply.
could you help to reply first question?
Hello @Felix_ar
Do you mean this question "input frequency is low, why must use a high frequency PR setting be used to calculate the correct number of pulses?" ?
Why do you say "must"? You can config the clock refer to your own requirements.
BR
Alice
Hi Alice
Maybe I had some misunderstand, I think the key point is PR setting, because CTimer function input clock can't change.
Thank you reply.
Hello @Felix_ar
Could you please describe this question more detail? You can take example to me, thanks.
BR
Alice
Hi Alice
As explained on page 9 of the user manual, only one clock source input to CTimer function and that doesn't have any clock adjustment function, so CTimer sample rate clock frequency equal to input clock.
originally I wanted to adjustment PR setting to change sample rate, but this idea is wrong, PR setting only change counting method.
above is my understanding.
if I have any mistake, please correct me.
Thanks.
Hello @Felix_ar
"PR setting only change counting method."
->> Yes,When the Prescale Counter (PC) is equal to this value, the next clock increments the TC and clears the PC.
BR
Alice