Hej Mario Thomaidis. Tack fšr ditt meddelande 23:36 1999-09-08 -0400 enligt nedan: Of course... However many bits you have, however stable the A/D is, however good filters you use, you will have flickering in the LSB when the input walue is between xxxxx1 and xxxxx0. And, if that happens to be, lets say in the middle of input range, *ALL* bits will flicker then, between 011111 and 100000 ! Very natural if you think about it. What we have to do, is 1) provide more than one bit extra, for the following step (could be done i.e. using rolling averge) 2) adding some sort of hysteresis to snap to allowed output values Example (using decimal system): Resolution is ones. Lets say we want to snap to tens. Currently we are outputting the result 50. Using hysteresis -/+10: We will not snap to 60 until the input (after filter) is 60 ore more And then not back to 50 unless input is 50 or less We will not snap to 40 until the input (after filter) is 40 ore less And then not back to 50 unless input is 50 or more Compare with using rounding: Input>55 give output 60 Input<=55 give output 50 Which would flicker the outpt even if input only flickers 1 LSB We can use a hysteresis of less ore more then the output resolution: Example less: output 60 when input rises to 58; back to 50 if input lowers to 52 Example more: output 60 when input rises to 62; back to 50 if input lowers to 48 The noise have to be guaranteed to be less than the hysteresis, one method is to extend the number of values in the rolling average filter in 1), or use a more effective filter like my filter idea "MOMA" posted last spring (i think it was) Never done this in practise Comments welcome Regards /Morgan >Hello, > >I am using a 16c73a to sample an array of 40 pots (10k). The pots are >passed through an 8 to 1 multiplexer (MM74HC4051, five of them), >selected by way of three select lines, and are inputted into all five of >the A/D channels. > >Set-up Info >I am currently allowing for an aquisition time of 20us. Also, while I >only require 7 bit resolution, I am allowing for conversion for a full 8 >bit value. I have tried both Fosc/32 and RC for the conversion clock >sourcing (one of my questions). I am also including a 2.5*Tad reset time >after a conversion before I begin aquiring the next A/D channel. I have >filter (charge sourcing) capacitors on the pot output pin (20 nF), the >multiplexer output pin / AD input pin (5 nF) and on Vdd (5 nF and 4.7 >uF). > >Problem >As I indicated, I only need 7 bits of *stable* resolution. The problem >is that while I allow for full 8 bit conversion and discard the LSb, the >7 bit value is unstable (can oscillate between two values). I should >indicate that the oscillation do not happen to all the pots at the same >time, only a couple at once (but all of them at some point). I have >looked through the Microchip literature and the PICList archive, but >have not found any helpful info. In fact, I have found some >contradictory (or, at the very least mutually exclusive) information. > >Contradictory Info >For example, in FACT002 Table 1, it indicates that the RC conversion >clock can be used with any speed clock source (I use a 20 MHz crystal >clock oscillator), while in the DS30390E Table 13-1, it indicates that >the RC mode should only be used in sleep mode for devices with clock >speeds above 1 MHz (to reduce digital switching noise). Personnaly, the >latter makes more sense to me. > >I have even rearranged my code so that no output pins are changed during >the converion (as per the advice in FACT002). I was sure this was my >problem ... but just like the cat ... > >Does anyone have any insight into what I may be doing wrong. Does anyone >know of any hardware type of filtering I can do to improve my resolution >(e.g. better capacitor values)? Or how about some simple code technique >(e.g. wait longer between samples)? I have considered software >filtering, but since I would have to run the filter 40 times (once for >each pot), I have been inclined to avoid it. Unless of course someone >could direct me to a simple and quick algorithm to do this (I don't mind >codifying and then posting the code). I am almost at the point of >turning to an off chip A/D. Has anyone suffered through the same or >similar problems? Any insight would be greatly appreciated. > >Mario Morgans Reglerteknik, HŠllekŒs, 277 35 KIVIK, SWEDEN tel +46(0)414-446620, fax -70331, mrt@iname.com