On 3/18/08, alan smith wrote: > I'm using a Optek sensor OPB745, and its appliction is > counting cycles based on a wheel that has alternating dark > and light markings. Rotational speed is about 25RPM and > it can detect the difference between black and white by > using the analog port of a 16F818 but now and then it seems > to get a glitch and counts twice inside a dark section. I tried > a simple filter to try and eliminate those glitches, but it runs > the chance it then delays the detect of the light area. > ... > I assumed analog detection is the right way to go.....or is it? Another solution is to use a better sensor. Most of the decent photoelectric switch will do the job and not having gliteches. If it counts twice in the dark section, this means that the dark side is not dark enough for this paticular sensor. Xiaofan -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist