AnsweredAssumed Answered

DSC IMPY.L how to saturate the result?

Question asked by agostino facotti on Mar 25, 2020
Latest reply on Mar 27, 2020 by agostino facotti

Hi all,

I've a question about the simple integer multiplication.

I'm amplifying an ADC result with a gain factor: the problem is that I do the moltiplication with the simple integer multiplication "*"(with is translated to IMPY.L in asm) and the core does not saturate the output; if accidentally the original signal grow too much the moltiplication overflows. This happens even if I enable saturation on the core.

 

Attached you can find an example project that runs on DSC Full Chip Simulator and a screenshot of the overflowed result.

My question is: is there a way to do this multiplication with saturation?

The only alternative I've found till now is to calculate the limit of the unamplified signal and to limit it...

 

I'm using Codewarrior for MCU version 10.6; the target is a MC56F84763.

 

Thanks everyone for your help!

 

Screenshot of Codewarrior with IMPY that does not saturate.

Outcomes