How to control cycles of Timer Our component from PE?

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

How to control cycles of Timer Our component from PE?

跳至解决方案
717 次查看
tomasmickus
Contributor II

Simple question, how could i set a function for Timer Out component ( which is PWM 50:50 generator, up to 24Mhz i think), to tick for example 10000 periods and then set flag that it done it or wait while it do it and then stop? FRDM-Kl25Z

Strange that there is no build-in function for that :smileysad:

1 解答
477 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

If there would be the number of pulses up to 256, you can use the PPG_LDD component, which allows to specify the number of pulses.

Otherwise, you would need to enable interrupt and in the OnInterrupt event routine increment a software counter and after it reaches given number (e.g.10000) call the Disable method of the component to stop pulse generation.

Best regards

Petr Hradsky

Processor Expert Support Team

在原帖中查看解决方案

0 项奖励
3 回复数
478 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

If there would be the number of pulses up to 256, you can use the PPG_LDD component, which allows to specify the number of pulses.

Otherwise, you would need to enable interrupt and in the OnInterrupt event routine increment a software counter and after it reaches given number (e.g.10000) call the Disable method of the component to stop pulse generation.

Best regards

Petr Hradsky

Processor Expert Support Team

0 项奖励
477 次查看
jackblather
Senior Contributor I

I looked at the TU0_Disable() method of the TU0 PEx component....it disables the *entire* peripheral. How do I disable the output of just a selected channel? The Vybrid RM mentions an Output Mask (section 39.4.15). This would be ideal, but PEx does not provide an interface for it.

Perhaps I just need to use the FTM_PDD_WriteOutputMaskReg() macro in FTM_PDD.h? However, there is no Read version of this macro, so in order to not clobber the existing bits, I'll have to call FTM_OUTMASK_REG() instead: Once for read, then OR my bits, the write it back. Is that going to work?

On Edit: I verified that this indeed works. Using the FTM_OUTMASK_REG() macro is all you need to manipulate the Output Mask of each individual channel.

0 项奖励
477 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

Your approach is perfectly ok, however, a simpler solution can be using the method SelectOutputAction of the TimerUnit_LDD coponent (I suppose you are using it).

If you use OUTPUT_NONE option there, no output is performed for a channel specified by the ChannelIdx parameter.

Best regards

Petr Hradsky

Processor Expert Support Team