Other Parts Discussed in Thread: LAUNCHXL-F280039C, C2000WARE
Tool/software:
I encountered some calculation errors.
static int16_t LvBswPwm_Period_Cnt=2400; static uint16_t test[6]; test[0]=(1.0f/6.0f*LvBswPwm_Period_Cnt); test[1]=(2.0f/6.0f*LvBswPwm_Period_Cnt); test[2]=(3.0f/6.0f*LvBswPwm_Period_Cnt); test[3]=(4.0f/6.0f*LvBswPwm_Period_Cnt); test[4]=(5.0f/6.0f*LvBswPwm_Period_Cnt); test[5]=(6.0f/6.0f*LvBswPwm_Period_Cnt);
All the calculation results are correct except for 5/6, it would be 0 but not 2000.
Some configurations are as follows:
Some solutions have tried:
1- change Optimization Level to off, 5/6 result will be right;
2-(5.0f*LvBswPwm_Period_Cnt)/6.0f, the result will be right;
I would like to know what caused this.