LPC844M201JHI33 CTimer issue?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC844M201JHI33 CTimer issue?

跳至解决方案
1,156 次查看
Felix_ar
Contributor III

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.

标签 (1)
0 项奖励
回复
1 解答
1,133 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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.

Alice_Yang_1-1699002403284.png

 

 

BR

Alice

在原帖中查看解决方案

0 项奖励
回复
7 回复数
1,134 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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.

Alice_Yang_1-1699002403284.png

 

 

BR

Alice

0 项奖励
回复
1,108 次查看
Felix_ar
Contributor III

Hi Alice

 

Thank for you reply.

could you help to reply first question?

 

0 项奖励
回复
1,094 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复
1,020 次查看
Felix_ar
Contributor III

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.

0 项奖励
回复
1,010 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Felix_ar 

Could you please describe this question more detail? You can take example to me, thanks.

 

BR

Alice

0 项奖励
回复
1,006 次查看
Felix_ar
Contributor III

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.

0 项奖励
回复
982 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复