NXP expert,
Please help trouble shoot code(a function and its call) below. why I got dutyU, V & W all equal to zero?
And would please provide a piece of suggested code to calculate: 4000*(19661/65535), the 3 numbers for in all integers(uint16), and the result should be integer(uint16) too, for MPC5744P motor control using S32DS.
FLEXPWM_set_duty(19661, 19661, 19661);
tBool FLEXPWM_set_duty(tU16 x, tU16 y, tU16 z){
 tU16 periodCarry, dutyU, dutyV, dutyW;
 dutyU = x;
 dutyV = y;
 dutyW = z;
 periodCarry = 4000;
 dutyU = (tU16)MLIB_Mul((tFloat)periodCarry, (MLIB_Div_FLT((tFloat)dutyU,(tFloat)65535)));
 dutyV = (tU16)MLIB_Mul((tFloat)periodCarry, (MLIB_Div_FLT((tFloat)dutyV,(tFloat)65535)));
 dutyW = (tU16)MLIB_Mul((tFloat)periodCarry, (MLIB_Div_FLT((tFloat)dutyW,(tFloat)65535)));
at this point, I got dutyU, dutyV, dutyW all equal to zero, but I am expecting them all 1200.
return (TRUE);
}
thank you very much.
Susan Li