Hi Jim, There are a couple of things you could do. If you lowpass after the deadband code, then you'll get a smooth transition and it won't bump quite so much. Another thing you can do is left-justify your converter results so it is 16 bits with 6 dead LSB bits, add a small amplitude triangle wave to it(say 6 or 7 bits), lowpass it, subtract half of the max triangle value, then shift right down to 11 bits, feed that to the deadband code. I may not have that quite right, but it's like something I did for a temperature readout once and it worked well. I forget what period I used for the triangle wave but I think one cycle was about every 32 samples of the A/D. Best regards, Bob On Thu, Nov 26, 2015, at 11:10 PM, Jim Ruxton wrote: > Thanks Bob, > This is actually what I have now however it reduces the resolution of my= =20 > system from 1024 values to 1024/(deadband+1) . I was hoping to avoid=20 > the drop in resolution. I am building a light dimmer so I want as=20 > gradual a curve as possible when I am moving the POT to control the > output. > Jim > > #define DEADBAND 1 > > > > if ((oldval + DEADBAND) > newval) > > updateVal(newval); > > if ((oldval - DEADBAND) < newval) > > updateVal(newval; > > > > Don't worry about rollover/under, as long as all values are unsigned. > > > > Still dithering? Increase DEADBAND to 2. > > > > Cheers, Bob > > > > On Thu, Nov 26, 2015, at 08:28 PM, Jim Ruxton wrote: > >> Thanks everyone for the suggestions. I don't think in my case it is > >> really a filtering issue because for example if my POT is set close or > >> on the edge of an A/D transition I believe I will still see a bit > >> flipping occasionally in the LSB if I have lots of filtering. Not sure > >> if I am being clear but I really only want to have the reading change = my > >> output if I am moving the POT so thought there would be a clever way t= o > >> detect that and only update my output if the input is varying > >> substantially. Perhaps to really get the best results I need a > >> multiturn POT or move to a digital encoder. > >> Thanks, > >> Jim >=20 --=20 http://www.fastmail.com - A fast, anti-spam email service. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .