Have you tested this fast averaging with Hysterisis by Darrel:

http://www.picbasic.co.uk/forum/cont...ith-hysteresis

Ioannis