Using timerint and the "list of values".

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

Using timerint and the "list of values".

1,159 次查看
barbercolman
Contributor III

I am ssing timerint and the "list of values". It appears that the list of values is limited to 16 items. Is it possible to increase this limit?

标签 (1)
3 回复数

801 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

unfortunately, this is a limitation of Processor Expert.

If you need to change for example period at runtime, it's possible to use the TimerUnit_LDD component and it's method SetPeriodTicks (you need to switch to Advanced view mode to see all methods).

Best regards

Petr Hradsky

Processor Expert Support Team

0 项奖励
回复

801 次查看
xiaocongfu
NXP Employee
NXP Employee

Hello Petr,

The explanation of SetPeriodTicks is: "set timer re-initialization period (in timer ticks)". I can't understand what is the meaning of in timer ticks. Can you please explain in detail about using this function? Better with an exemple.

Thank you in advance

Xiaocong

0 项奖励
回复

801 次查看
Petr_H
NXP Employee
NXP Employee

The timer contains a counter that counts to some specific number (modulo) which determines the period.

The real time of the period is determined by the "time ticks number" * "length of the timer tick". The length of one timer tick is determined by input frequency of the timer set in the component.

For example, let's have 3MHz input clock and 10ms period (on-match mode using TPM0 modulo register for period is used because it allows adjusting the period).

pastedImage_2.png

Then, if you look into TU1.h (or other name if you renamed the component), you should have the constants like this:

...

#define TU1_CNT_INP_FREQ_U_0 0x002DC6C0UL /* Counter input frequency in Hz */

#define TU1_CNT_INP_FREQ_R_0 3000003.000003F /* Counter input frequency in Hz */

#define TU1_CNT_INP_FREQ_COUNT 0U      /* Count of predefined counter input frequencies */

#define TU1_PERIOD_TICKS   0x7530UL    /* Initialization value of period in 'counter ticks' */

#define TU1_NUMBER_OF_CHANNELS 0x00U   /* Count of predefined channels */

So you can see that the period is 0x7530 ticks, which is 30000 in decimal base. The period in real time would be 30000 * (1/input frequency) = 30000 * (1/3000000) = 0.01s = 10ms

By the way, these constant are useful if you'd like to do time calculations in your code.

best regards

Petr Hradsky