- From: Jan-Alexander Heimel <heimel_at_brandeis.edu>
- Date: Sat, 28 Sep 2002 14:01:05 -0400 (EDT)
On Thu, 26 Sep 2002, Michael Wagner wrote:
> I am trying to read two analog inputs back to back, using code like
> this:
>
> while(1) {
> comedi_data_read(adc, SUBDEV_AD, channel[0], range, AREF_DIFF,
> &data);
> volts = comedi_to_phys(data, rangeType[0], maxData[0]);
> printf("AD on first channel says %f volts\n", volts);
> comedi_data_read(adc, SUBDEV_AD, channel[1], range, AREF_DIFF,
> &data);
> volts = comedi_to_phys(data, rangeType[1], maxData[1]);
> printf("AD on second channel says %f volts\n", volts);
> // sleep for about 0.1 seconds
> }
>
> Unfortunately this doesn't work!
I do not know too much about these matters, but I suspect that your
problem could be related to the settling time that the board needs to
switch between channels. The two comedi_data_read commands might be issued
too quickly after one another, so that the acquisition board does not have
time to converge to the proper value. Too avoid the problem you could
issue a comedi_command instead of the subsequent data_read's. In your
manual of the acquisition board there should be a table of typical and
maximum settling times. I also recall having seen a discussion on this
matter in the comedi mail archive.
I hope this is of some help and apologize if I am writing nonsense.
Hopefully, somebody will correct me if I am wrong.
Regards,
Alexander
Received on 2002-09-28Z17:01:05