Program PID algorithm into microcontroller 16f877

Discussion in 'Embedded Systems and Microcontrollers' started by jeremy1409, May 19, 2010.

  1. jeremy1409

    Thread Starter New Member

    May 19, 2010
    1
    0
    Hi everyone;

    My project title is "temperature control telemetry", and the temperature sensor that i'm using now is SHT75 and i already program the sensor and it is working fine. But now i need to write the PID algorithm into the microcontroller to control my temperature on the set point and i don't know how to program this PID control into it. So i need help here :(. thx~~
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    The following equations will perform the PID if they are executed in an interrupt function with fixed timing. Also, the sampling of the temperature sensor has to happen in the interrupt.

    P=Kp*error
    I=I+Ki*error
    D=Kd(error-error1)

    output=P+I+D

    error is the current difference between the desired temperature and actual temperature

    error1 is the previous value of error
     
Loading...