How to control cycles of Timer Our component from PE?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to control cycles of Timer Our component from PE?

ソリューションへジャンプ
724件の閲覧回数
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 解決策
484件の閲覧回数
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 返答(返信)
485件の閲覧回数
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 件の賞賛
484件の閲覧回数
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 件の賞賛
484件の閲覧回数
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