SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
There are 3 clamps in the filter structure, for the integrator, the output of the PID filter, and the output after the feed forward multiplier. The integrator and filter clamps are signed 24 bit numbers, like the output of the integrator and filter are. The overall output clamp is an unsigned 18 bit number, like the overall output.
Here is an example of clamping everything to a range from 10% to 50% of full scale.
Filter2Regs.FILTERYNCLPHI.bit.YN_CLAMP_HIGH = 0x400000; //50% of full scale
Filter2Regs.FILTERYNCLPLO.bit.YN_CLAMP_LOW = (int)(((float)0x800000) *.1);
//10% of full scale
Filter2Regs.FILTERKICLPHI.bit.KI_CLAMP_HIGH = 0x400000; //50% of full scale
Filter2Regs.FILTERKICLPLO.bit.KI_CLAMP_LOW = (int)(((float)0x800000) *.1);
//10% of full scale
Filter2Regs.FILTEROCLPHI.bit.OUTPUT_CLAMP_HIGH = 0x20000; //50% of full scale
Filter2Regs.FILTEROCLPLO.bit.OUTPUT_CLAMP_LOW = (int)(((float)0x40000) *.1);
//10% of full scale