This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28379D: Float to int conversion with the CLA

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