LPC844M201JHI33 CTimer issue?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC844M201JHI33 CTimer issue?

Jump to solution
763 Views
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.

Labels (1)
0 Kudos
1 Solution
740 Views
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

View solution in original post

0 Kudos
7 Replies
741 Views
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 Kudos
715 Views
Felix_ar
Contributor III

Hi Alice

 

Thank for you reply.

could you help to reply first question?

 

0 Kudos
701 Views
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 Kudos
627 Views
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 Kudos
617 Views
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 Kudos
613 Views
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 Kudos
589 Views
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 Kudos