Funny you should ask, Im working on the same project at the moment. The only problem Im having is the maths routines, they seem to be getting up to 64 bit. The actual calculation is- dMV=G[dE + E*T1*I + D* (dE/T2)] where- dMV = change in Manipulated Variable G = Gain (100/Proportional Band) E = Error (SetPoint - ProcessVariable) for reverse action, Error (ProcessVariable - Setpoint) for direct action dE = ErrorThisScan - ErrorLastScan T2 = Time between scans (in minutes) T1 = Time since error occured (in minutes) I = Integral time (R/M) D = Derivative time (minutes) There are other things to consider as well, integral windup, bumpless transfer from manual to auto, etc Anyone knowing any alterations to this equation or anything else that might make writing this code easier are most welcome to reply Justin Grimm reaper@southwest.com.au ---------- > From: Mark Lezama > To: PICLIST@MITVMA.MIT.EDU > Subject: PID question. > Date: Friday, 6 March 1998 21:09 > > I have working with RTU designe base in PIC16c74. I have to control a > valve with a 4-20 ma signal, but I want to implement a digital PID > controller, anyone here have a PID code or can explain me how I have to > implement. > > Thanks in advance! > > Mark Lezama