Thanks Justin. I will try to implement. I think is the problem is the # of bit I have to use a floting point rutine. BTW, in the formula I dont know what means "Time since error ocurred", maybe Is a fool question but I am trying to understand anything before implement the code. Mark Lezama. Justin Grimm escribis: > 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