> (Derived from a speed sensor of immaterial description) Subtract the > 'actual' from the 'setting', and, if a negative result, add to the > result to the PWM register, or if a positive result, subtract it from > the PWM register. (In either case, leave the 'setting' unchanged, and > just add to the PWM register, so the next comparison will be made with > the 'setting' figure, not the actual PWM register) > > So, in example, 1000 - 900 = 100. Add to PWM register, which becomes > 1100. The motor speeds up, perhaps miraculously to 1000. Then, at next > comparison, 1000 minus 1000 = 0. Add 0 to the PWM register and nothing > changes, motor continues to run at 1000! Change the setting, or the > motor changes, and it will compensate. > > Won't it?????? It might oscillate a bit, but maybe not much. > As long as the load is constant, the above (proportional) method works quite well. Don't expect too much in terms of stability when applying random changes in loading,though. Been there, done that ;-) Ian Rozowsky Engineering Manager Centurion Systems P.O. Box 506 Cramerview 2060 South Africa Tel : +27-11-462-4499 Fax : +27-11-704-3412 e-mail: roz@centsys.co.za web: http://www.centsys.co.za -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics