MC_PMSM :: /* initial value of the FTM counter */

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

MC_PMSM :: /* initial value of the FTM counter */

630件の閲覧回数
amerzater
Contributor III

Can I ask what is the meaning of the minus operator (-)at defining the initial value of FTM0 for generating 3phase PWM signals at MC_PMSM library?

what does it mean?

Simply, the initial value of FTM0 should be assigned to  ui16PwmModulo / 2 ...not to (-ui16PwmModulo / 2 )

/* initial value of the FTM counter */
FTM0->CNTIN = (uint32_t)(-g_sClockSetup.ui16PwmModulo / 2);

ラベル(2)
1 返信

550件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I debug the PMSM demo with FRDM-KV10Z board and get below result:

pastedImage_1.png

The FTM0 CnV registers value is:

pastedImage_2.png

You could find the function of  '-' is to bit inversion of variable value.

0xF8AE is bit inversion of 0x752 of 16 bit variable.

Wish it helps.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------