Hi again, just another small note... Bill Couture wrote : > Since the PID is in the interrupt, it runs EXACTLY on > schedule. Although, > there is some jitter, based on the values in the loop. For > example, with > PID, Kp, and delta_position all long ints > PID += Kp * delta_position; > is *MUCH* slower (about a factor of 2) if delta_position is negative > intead of positive. In fact, if you do it right, you can save > processing > time with statements like > pos_delta_pos = (current - desired); > neg_delta_pos = (desired - current); > if (current > desired) > PID += Kp * pos_delta_pos; > else > PID -= Kp * neg_delta_pos; > (you do have to be careful that you don't spend more time saving time, > but if you're careful you can save considerable time.) This app is written in C, right ? Maybe you could speed up the PID calculation by re-writing it in optimized ASM and calling that from your C code ? Jan-Erik. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads