i'm doing a project on teperature controller on p89v51rd2.. i need a help... if have any reference code..
kalpesh.
kappu92[at]gmail.com
Posts: 14,118
Threads: 61
Joined: Oct 2014
This code is a working example of a PID control (Proportional, Integral, Derived). This type of control is used when processes change due to inertia. (The cruise control of a car is a PID controller.) The PID algorithm is surprisingly simple and can be implemented in five lines of code. There are three constants that must be determined to shape the output of the control. The three constants, as well as the setpoint and the sampling interval can be changed in real time. The resulting shape of the output will be displayed on a strip chart.
Many real-world processes accumulate over time. When you step on the accelerator, your car moves slowly, then faster and faster, until you release the accelerator. As you accelerate, press the accelerator pedal less, then a little less, and even less, until you reach the speed limit. Unlike the digital world where things are "turned on" (1) or "deactivated" (0), the actual processes have different degrees of "on." In the example of driving, how much the throttle is activated depends on the current inertia of the car and how different the speed of the car is from the speed limit. The control of such a process with inertia can be done with only five lines of code. But, just like learning to drive, it takes practice to know if you are starting too fast, or if you are going to exceed the speed limit.
The cruise control is an example of a PID control loop. To calculate production, you need three factors. The first, (P), is the difference between the current speed and the desired speed. The second, (I), is the sum of the differences in time. And, the third, (D), is the exchange rate between the sampled differences. Each factor is scaled by a gain constant; They are called Kp, Ki and Kd. The value of these gain constants determines the responsiveness of the output. If the values Kp, Ki and Kd are too high, the output (speed of the car) will far exceed the set point (speed limit). Setting too low, the output can never reach the set point (such as driving 40mph on the road).