> I am using a pot and the high resolution mode of an A/D on the 16f1828 . > I am directly controlling a 10 bit PWM with the result of the 10 bit A/D > input. I have a problem in that I want to avoid the noise of the A/D > input from affecting my output. This happens if my pot is set just > between two levels so the output fluctuates between two levels. Not very > much only 1 or 2 levels out of the 1024 but this is significant in my > application. I really only want the output to change if I physically > move the pot. Currently I have fixed it by only outputting to the PWM on > the output if the input changes by more than 2, assuming if it does I am > moving the pot. This works in that my output is steady however it > effectively lowers my resolution as well since the output now steps only > when the pot moves more than 2 values. I was wondering if I should set > up a timer interrupt for say 1 second and if the output changes by more > than 2 during that second assume the pot is being moved and allow level > increments of 1. If it didn't move by more than 2 during that second > assume the pot isn't being moved and lock the output. Am I on the right > track here or can anyone recommend another technique . > Jim You could use an averaging technique to smooth out the transitions. Something like this: #define k=3D64; // smoothing constant static UINT16 SmoothValue=3D0; SmoothValue=3D((SmothValue*k)+NewValue)/k; return(SmoothValue); Harold --=20 FCC Rules Updated Daily at http://www.hallikainen.com Not sent from an iPhone. --=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 .