That is actually fairly typical. Most cards do not have an individual
A/D converter for each channel. They have a single A/D converter and an
analog MUX to switch the input. Also, the A/D converter does not
respond to changes in its input voltage (such as will occur when
switching channels on the MUX) immediately. There is a maximum rate of
change of voltage that it can track, known as the "slew rate".
When reading an analog input channel on a card with a MUX, the Comedi
driver first switches the MUX to the desired channel and then triggers a
conversion. Due to the slew rate, the A/D conversion can happen before
the A/D converter has settled down to the new input voltage.
When you read the same analog input channel a second time, the A/D
converter input has already settled down to the new input voltage, so
the reading is more accurate.
There is a function `comedi_data_read_n` that reads the same channel
multiple times. If you call that on a new channel, you should see the
data gradually settling to the final reading.
There is also a function `comedi_read_data_delayed` that adds a delay
between changing the channel and reading it. (In reality, it reads the
channel twice with a delay between them, but discards the first reading).
There is also a function `comedi_data_read_hint` that supposedly changes
the channel but does not read it. (In reality, it does read the channel
but discards the data.)
--
-=( Ian Abbott <
abb...@mev.co.uk> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. ||
www.mev.co.uk )=-