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);
Hi,
I debug the PMSM demo with FRDM-KV10Z board and get below result:
The FTM0 CnV registers value is:
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!
-----------------------------------------------------------------------------------------------------------------------