Hi,
You don't need to change anything. If you're aiming for speed control only then simply measure the speed of your motor with whatever you like, encoder, tachometer, BEMF or whatever. Compare that to your target speed and send the difference between the two (ie. the error) to the PID-filter. The filter itself does not know or care what you are regulating, it might as well have been air-pressure as far as the PID-routine is concerned.
If you need to move to a certain position WITH a certain speed then you need to take the moving target aproach like RODStart outlined. If you control position and add 1 to the target position every second the motor will move 1 encoder count every second or 10.8° per minute or 0.03rpm with a 500line encoder.
Regarding the pots, you can set the PID gains in any number system you like. The reason I show it in hex is that it is easier IMO. You can simply do pid_Kp = myADResult if you like.
1023 in decimal is the same as $03FF which, in the PID filter, is treated as 3.996 basically. See, 03 is the number on the left side of the decimalpoint and FF is on the right side. FF represents 1/256*255 or 0.996. If you'd feed it 102 from the ADConverter it would be the same as $0066 or a gain of 0.258.
If you need more gain than 1023 then simply multiply your ADResult, pid_KP=myADResult*2, now you get a gain of 0-2046 or $0000-$07FE or 0.0-7.992
/Henrik.




Bookmarks