PID algorithm relation with PWM duty cycle

Discussion in 'General Electronics Chat' started by Irmutis, Mar 13, 2013.

  1. Irmutis

    Thread Starter Member

    May 24, 2009
    Hello everyone,

    I am trying to design SEPIC converter. I am going to use typical SEPIC schematics ( ) to drive MOSFET with PWM by changing duty cycle. I am going to use PID algorithm C code from STM:

    uint16_t DoFullPID(uint16_t In, uint16_t Ref, uint16_t *Coeff)
    uint16_t Kp, Ki, Kd, Output, Error;

    Error = Ref - In;
    Kp = Coeff[0];
    Ki = Coeff[1];
    Kd = Coeff[2];

    IntTerm_C += Ki*Error;
    Output = Kp * Error;
    Output += IntTerm_C;
    Output += Kd * (Error - PrevError_C);

    PrevError_C = Error;

    return (Output);

    The main thing I do not understand how to relate OUTPUT with PWM duty cycle? Maybe somebody could advice me or show any example code?
  2. Jaguarjoe

    Active Member

    Apr 7, 2010
    Honeywell makes "UDC" (universal digital controller) in a few different generations (UDC2000 and 3000). Their instruction manual explains PID with PWM.

    PID'd PMW is common in heater control.