CAD CAM EDM DRO - Yahoo Group Archive

RE: [CAD_CAM_EDM_DRO] PID in a PIC

Posted by Tim Goldstein
on 2000-08-10 16:15:18 UTC
Parallax (the basic stamp people) have just put out a stamps in class
curriculum on Industrial Control. Chapter 6 is entirely about PID on a
stamp. It should be relatively easy to port the code to PICBasic Pro, but
may be a little more of a challenge to port it to C.

The manual is on the parallax website as a free download.

Tim
[Denver, CO]

> -----Original Message-----
> From: Alan Marconett KM6VV [mailto:KM6VV@...]
> Sent: Thursday, August 10, 2000 3:37 PM
> To: CAD CAM EDM DRO
> Subject: [CAD_CAM_EDM_DRO] PID in a PIC
>
>
> Hi to the List,
>
> I have been researching PID algorithms, and would like to implement a
> PID formula in a simple project(?) for my son. The Project is a "line
> following robot", and what we want to build is a PIC micro controller
> running a PID calculation. The input "error" is calculated
> from levels
> from an array of IR sensors. There are to be three pots digitized for
> the Kp, Ki & Kd gains. The output of the calculation will be used to
> control an R/C servo via PWM. The R/C servo steers the robot (car).
>
> The sensors, pots, and PWM stuff is all fine, but in trying
> to implement
> the PID calculations, I find that I don't know much about it.
>
> A PID in a PIC has other obvious uses in CNC.
>
> I came up with this 'C' code from an "Embedded Systems Programming"
> magazine pseudo code example, am I on the right track?
>
> dt = .001; // 1000 loops/sec?
>
> while(1)
> {
> Sum = OldSum + Error;
> Output = (Kp * Error) + (Ki * Sum * dt) + (Kd * (Error -
> OldError)/dt);
> OldError = Error;
> OldSum = Sum;
> }
>
> If you have any comments, or a more thorough example, I would
> appreciate
> seeing it(them). I don't normally program Integral or derivative
> equations!
>
> Alan
>

Discussion Thread

John Craddock 2000-08-10 15:53:35 UTC RE: [CAD_CAM_EDM_DRO] PID in a PIC Tim Goldstein 2000-08-10 16:15:18 UTC RE: [CAD_CAM_EDM_DRO] PID in a PIC Alan Marconett KM6VV 2000-08-10 17:34:18 UTC Re: [CAD_CAM_EDM_DRO] PID in a PIC Alan Marconett KM6VV 2000-08-10 17:39:17 UTC Re: [CAD_CAM_EDM_DRO] PID in a PIC Charles VanLeeuwen 2000-08-10 19:41:39 UTC Re: [CAD_CAM_EDM_DRO] PID in a PIC Alan Marconett KM6VV 2000-08-10 20:20:31 UTC Re: [CAD_CAM_EDM_DRO] PID in a PIC Scott Stephens 2000-08-11 06:21:17 UTC Re: PID in a PIC Alan Marconett KM6VV 2000-08-14 11:56:57 UTC Re: [CAD_CAM_EDM_DRO] PID in a PIC