Shop OBEX P1 Docs P2 Docs Learn Events
ADC refresh rate — Parallax Forums

ADC refresh rate

I am going to run 8 pins of adc in its own Cog. How often can I refresh them?
Jim

Comments

  • evanhevanh Posts: 15,187

    They're good for a couple of MHz with AC signals. But if you're wanting to do DC instrumentation sampling then it's much much slower because of the need to continuously cycle between GIO, VIO and the pin.

  • @RS_Jim said:
    I am going to run 8 pins of adc in its own Cog. How often can I refresh them?
    Jim

    It depends on the resolution number of bits, that you need. The adc's are independent from each other. Details can be found on page 95 https://docs.google.com/document/d/1gn6oaT5Ib7CytvlZHacmrSbVBJsD9t_-kmvjd7nUR6o/edit#heading=h.583eaakkvf1j
    In my opinion the word ENOB is used wrongly there. It is used for resolution, while normally it is used for a signal to noise ratio. I have not seen data, which give more than 12 bits of "real ENOB". Averaging can often help.

  • Thanks @evanh for the feedback. However, I am not understanding what you are meaning by cycling through GIO,VIO and the Pin.
    Jim

  • evanhevanh Posts: 15,187
    edited 2023-01-25 22:25

    GIO and VIO are the measurement of the ground and pin supply voltages. Those have to be measured, as well as the pin's input voltage. And, because of the drifting of the ADC hardware, they need to be repeatedly re-measured over the duration.

    Have a read of this source code and maybe some of the topic on thermistor sampling too - https://forums.parallax.com/discussion/comment/1545000/#Comment_1545000

  • evanhevanh Posts: 15,187
    edited 2023-01-25 23:04
            ratio = (float)(vio - gio) / (float)(vio - value) - 1.0;    // NTC Rt connected to GIO, R0 connected to VIO
            temperature = 1.0 / (log(ratio) / 3380.0 + 1.0 / 298.15) - 273.15;    // Thermistor Beta for 10 kR at 25 C
    

    The formula for the temperature relies on the external power supply of the thermistor being the same one as VIO. As such, the voltages don't need to be resolved. Temperature can conveniently be calculated with a numerical ratio only.

    PS: Remove the test bias when wiring a real thermistor.

    enum {
        PINBIAS = P_ADC,
    //  PINBIAS = P_ADC | P_OE | P_LOW_150K,
    //  PINBIAS = P_ADC | P_OE | P_HIGH_150K | P_INVERT_OUTPUT,
    };
    
Sign In or Register to comment.