Calculating upper and lower DAC references for a hysteretic controller of PowerPSoC device

Version 1
    Question: How can one calculate upper and lower DAC references for a hysteretic controller of PowerPSoC device?

     

    Answer:

     Example: Let the current through an LED string be 300mA with a ripple of 40%.

     

     So Iavg = 300 mA.

     

     Hence Ipeak = 1.2 x Iavg = 360 mA and Ivalley = 0.8 x Iavg = 240 mA

     

     Let the,

     

    sense resistance value Rsense = 0.22 W

    gain of CSA be 20 and,

    the 8-bit DAC be set at a resolution of 2.6V/10mV.

     Current sense voltage Vpeak = Ipeak x Rsense = 360 x 0.22 = 79.2 mV.

     

     

     Similarly Vvalley= Ivalley x Rsense = 240 x 0.22 = 52.8 mV.

     

     

     Corresponding to Vpeak and Vvalley, the output of CSA would be the gain multiplied by the voltage.

     

     

     Hence,

     

                            V’peak = Vpeak x 20 = 1.584 V and

                            V’valley= Vvalley x 20 = 1.056 V.

    Now, the peak or upper limit DAC reference is calculated as,

    REFupper = (V’peak/2.6) x 256 = 156

     

     

    Similarly, valley or lower DAC reference is,

     

     

    REFlower = (V’valley/2.6) x 256 = 104