sample code for PID controller

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sample code for PID controller

Jump to solution
5,867 Views
koka
Contributor I
hello everyone.
i'm working on MC9S08QD2 8-bit and 8-pin microcontroller, so i have to implement PID control for output current in my application. so can anyone tell me how to calculate Kp,Ki and Kd values. and if anyone provide me the sample code for PID control, i wll be so much thankfull. and also if any application notes and reference for PID for this microcontroller is there , please send the link , i will download.

so if anyone know please send me as early as possible.
Labels (1)
Tags (1)
0 Kudos
1 Solution
1,191 Views
Kopone
Contributor IV

Hi,

 

there are plenty of application notes out there on how to implement PID compensation.

E.g. Freescale offers AN1215 for download. Get it here

For more, just use Google.

If you really want to calculate Kp, Ki, Kd, you need to get into control theory, set up the closed loop equation for your particular application (which implies having a suitable model of the response characteristic of each component), define your requirements for speed, accuracy and stability range of your control and then go from there.

You might be better off  by simply setting up a lab experiment and find suitable values by trial and error. Start with P (keep D and I set to zero first).

 

Regards,

 Sven

View solution in original post

0 Kudos
2 Replies
1,192 Views
Kopone
Contributor IV

Hi,

 

there are plenty of application notes out there on how to implement PID compensation.

E.g. Freescale offers AN1215 for download. Get it here

For more, just use Google.

If you really want to calculate Kp, Ki, Kd, you need to get into control theory, set up the closed loop equation for your particular application (which implies having a suitable model of the response characteristic of each component), define your requirements for speed, accuracy and stability range of your control and then go from there.

You might be better off  by simply setting up a lab experiment and find suitable values by trial and error. Start with P (keep D and I set to zero first).

 

Regards,

 Sven

0 Kudos
1,191 Views
Thyristercontro
Contributor I

Hello Sir,

 

i am using MCF51CN128 microcontroller.

i want ot impliment PID controller using this microcontroller.

my feedback is current (DC) and using is current i vl control voltage. do you have any idea? please tell me

0 Kudos