http://members.aol.com/JohnShaw/pid/index.html has a good discussion of PID control including, one page down, a pseudo-code implementation. I haven't personally tried it but the explanation is quite clear and it might help. -----Original Message----- From: Koh Teik Siong To: PICLIST@MITVMA.MIT.EDU Date: Tuesday, December 16, 1997 12:38 AM Subject: PID algorithm II >HI > I am new to the PICLIST. I am now presently trying to implement a PID >controller and a trajectory motion control. I have look up the Embedded >Control Book,AN532, and it has a very good reference. But the problem is >that there are so many interrupts and function. Does anyone know of a >simpler way of writing the PID algorithm? > Presently, I have a PIC which calculates the velocity and the position >of the motor. But how am I going to get the info from the PIC? >Especially when it is has a 8-bit output for the velocity and position. > Another question is that can I use the same crystal for both my PIC? > Thanks, with regards,