CAD CAM EDM DRO - Yahoo Group Archive

Re: PID in a PIC

on 2000-08-29 20:06:40 UTC
Alan,

OT: I just received this post in digest form, and it's over two
weeks old. What's up with that!?

Anyway, since you asked I owe you a reply. My PID program runs in
Visual Basic on a P90 - I don't think I can really give you a good
speed number that'll apply in your project. With the added burden of
simulating the mechanical system that the motor is attached to and
drawing the output as a graph (not a small amount of calculation) the
program was able to run real-time. E.G., if it says it took 6 sec to
get to point B and stablize then it was actually six seconds in real
time to reach that conclusion numerically. Just the PID itself
should be quite fast, especially if you do it by integer math.

There are dedicated PID & PWM on a single chip packages out there
that run the whole shebang for P,V,A in 32 bits and self-tune as
well. I suggest one of these, and not re-inventing the wheel.

But if you *really* want to be slick and quick in your machine you
can wire up regular op-amps to do PID, one amp for each. Resistive
feedback for the P, capacitive for the I, and inductive for the D if
I recall correctly. Probably a hairy mess when tuning, but it can't
get any faster than that! Analog computers still rock!!

If you want the PID program in full, contact me off list.

Dave Kowalczyk
Ames IA

--- In CAD_CAM_EDM_DRO@egroups.com, Alan Marconett KM6VV <KM6VV@a...>
wrote:
> Thanks Dave,
>
> I like the idea of a "rolling" sum for the integral. And your
point of
> not needing to divide by dt because of the constant interval will
save
> time. Now to get it all into the PIC. How fast have you been able
to
> get the algorithm to run? My first thought was to include the PWM
for
> the R/C servo motor in the same routine, but it is so S L O W (do
a .5
> to 2.5 ms pulse every 20ms), that I may just put it in another PIC.
> Another PIC is slated to do PWM at 5-10 Khz for the drive motors.
Idea
> is to slow down the drive motors as the turning error comes up.
>
> Alan
>
> Dave Kowalczyk wrote:
{snip long, tedious description of PID mechanics}

Discussion Thread

Alan Marconett KM6VV 2000-08-10 14:38:32 UTC PID in a PIC Spehro Pefhany 2000-08-10 16:24:18 UTC Re: [CAD_CAM_EDM_DRO] PID in a PIC Tony Jeffree 2000-08-13 13:34:53 UTC Re: [CAD_CAM_EDM_DRO] PID in a PIC Dave Kowalczyk 2000-08-14 06:21:52 UTC Re: PID in a PIC Alan Marconett KM6VV 2000-08-14 11:28:23 UTC Re: PID in a PIC Dave Kowalczyk 2000-08-29 20:06:40 UTC Re: PID in a PIC