> The sequence is - > > (1) power-up > (2) sensor reading by PIC1 using 32ms IRQ > (3) sensor data ready within ~25ms > (4) at next PIC1 IRQ send data to pulse-generating PIC2 > (5) read sensor > (6) back to (2) Seems to me that some sort of predictive algorithm (which is partially what I have been drivelling about already) will allow you to live in the past but take note of the present in order to attempt to predict the future. Sounds more like magic than engineering :-) How would PID or a subset fit in here? Also, someone mentioned an accumulator system. Here is perhaps one version of what they had in mind. 1. Calculate a number of cycle that you want to fill and place this value in an accumulator. 2. Work out how long each pulse must be in uS (or cycles or whatever), set your timer to this value 3. Until one processing period (32 ms) is over Subtract X uS from the accumulator at each pulse. 4. At the end of the cycle the accumulator will be positive or negative (or zero if you are highly lucky). Get new value, calculate new number of required cycles and add to accumulator. This adds to the error signal remaining from last time. The new value depends on the new result and the error from processing the old result. 2. again .... ie calculate the new pulse lengths required each time and continue. RM -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu