talhataj
Newbie level 3
![Newbie level 3](/styles/images/ranks/alevel3.gif)
Hi Guys,
I am implementing a Stepper motor control using PID control technique on PIC18F452........ My question is i have designed the PID controller using a small code below,
Then the PID controller gives a numerical number, i have to multilply this number to the motor Transfer function, now the transfer function is in s-domain, i m confused while calculations in C language, with what numeric number or numeric entity should i replace the 's' or the frequency domain representation to get a desired numeric speed output.
PID TF = Kp + Ki/s......... using above code gives a numeric number (time domain calculations)
motor TF = 1/(s+4+jsqrt(3))(a+4-jsqrt(3))
now what i should replace 's' from in motor TF to use it in my calculatons.......
Please help
I am implementing a Stepper motor control using PID control technique on PIC18F452........ My question is i have designed the PID controller using a small code below,
Code:
//Variables
float actual_error, error_previous, P, I, D, Kp, Ki, Kd ;
{
error_previous = actual_error; //error_previous holds the previous error
actual_error = set_point - measured_value;
// PID
P = actual_error; //Current error
I += error_previous; //Sum of previous errors
D = actual_error - error_previous; //Difference with previous error
return Kp*P + Ki*I + Kd*D; //adjust Kp, Ki, Kd empirically or by using online method such as ZN
Then the PID controller gives a numerical number, i have to multilply this number to the motor Transfer function, now the transfer function is in s-domain, i m confused while calculations in C language, with what numeric number or numeric entity should i replace the 's' or the frequency domain representation to get a desired numeric speed output.
PID TF = Kp + Ki/s......... using above code gives a numeric number (time domain calculations)
motor TF = 1/(s+4+jsqrt(3))(a+4-jsqrt(3))
now what i should replace 's' from in motor TF to use it in my calculatons.......
Please help
Last edited: