Part Number: TMS320F28379D
Tool/software: Code Composer Studio
Hello,
I have a problem with the conversion from float to int with the CLA. The following picture shows the code.
The problem is the following line.
DaccRegs.DACVALS.all = (short)(u_drossel*(4095/(3.3/0.5*20))) + 2048;
u_drossel is a local float variable and contains a value of -60.0. The expression in brackets (4095/(3.3/0.5*20)) is equal to 31.022. This value is multiplicated with u_drossel and should be converted to a signed short variable. But the compiler uses MF32TOUI16 mnemonic instead of MF32TOI16, so the negative range of the value is not realized.
How can I fix this problem?
Thank you very much.
Ralf
