CAD CAM EDM DRO - Yahoo Group Archive

Re: [CAD_CAM_EDM_DRO] PID in a PIC

Posted by Tony Jeffree
on 2000-08-13 13:34:53 UTC
It's worth taking a look on the http://www.microchip.com/ website -
microchip publish a wide variety of application notes for the PIC series,
including stuff related to implementing 3-term control algorithms.

Regards,
Tony

At 14:37 10/08/00 -0700, you wrote:
>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
>
>
>
>Welcome to CAD_CAM_EDM_DRO@...,an unmoderated list for the
>discussion of shop built systems, for CAD, CAM, EDM, and DRO.
>
>Addresses:
>Post message: CAD_CAM_EDM_DRO@egroups.com
>Subscribe: CAD_CAM_EDM_DRO-subscribe@egroups.com
>Unsubscribe: CAD_CAM_EDM_DRO-unsubscribe@egroups.com
>List owner: CAD_CAM_EDM_DRO-owner@egroups.com, wanliker@...
>Moderator: jmelson@... [Moderator]
>URL to this page: http://www.egroups.com/group/CAD_CAM_EDM_DRO
>FAQ: http://www.ktmarketing.com/faq.html
>bill,
>List Manager

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