Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
I am using ADCINVR to measure to two different voltage and use DAC to supply to voltage, i am using mux to select pin01 and pin03 for measuring. There is problem. the first measurement always give me deviation. say i use pin01 to measure the voltage first, use pin03 to measure voltage then.
If i switch pins, then the pin03 measure the voltage first, the deviation is on pin03
if i do not use mux and use each seperately, i work properly . I thought i need a delay before DAC. but it does not work after i put delay before DAC.
That means you've asked for continuous samples. As the previous respondent said, you need to discard the first conversion after a mux change -- because the next conversion started before you changed the mux, so the conversion got part of one input and part of another.
Discarding one sample is one way to do it. I prefer to request one sample at a time, myself.
In my case I have state machines, time constraints and minimum sample rates, with conversions running in the background while I read buttons and send messages and so on, so I need better control. In your case you probably don't care, so just calling "while(ADCINCVR_fIsDataAvailable()==0);" twice in a row (with a "clear flag" between) is probably good enough. But I wanted to make the point. Because I'm a pedant. 🙂