It's my first time of implementing a PID controller for DC servo motor speed control.
Untill now I used a custom control function that was just add or sub the constant value 1 from the target PWM. The feedback is an encoder.
Now due to physical problems I need to switch to a PID controller. Can anybody help or tip me to do this real ?
I have some questions such as:
1. The error is either positive or negative. Do I have to use signed or unsigned variables ?
2. The PWM is 10 bit. The read value from the encoder is 16Bit. How can I use the 16bit value at my PID equation while the resault is a 10bit PWM value.
I am a little bit confused.