1COMEDI_DATA_READ(3) COMEDI_DATA_READ(3)
2
3
4
6 comedi_data_read - read single sample from channel
7
9 #include <comedilib.h>
10
11 int comedi_data_read (comedi_t * device, unsigned int subdevice,
12 unsigned int channel, unsigned int range, unsigned int aref, lsampl_t *
13 data);
14
16 Reads a single sample on the channel specified by the Comedi device
17 device, the subdevice subdevice, and the channel channel. For the A/D
18 conversion (if appropriate), the device is configured to use range
19 specification range and (if appropriate) analog reference type aref.
20 Analog reference types that are not supported by the device are
21 silently ignored.
22
23 The function comedi_data_read() reads one data value from the specified
24 channel and places the data value in the location pointed to by data.
25
26 WARNING: comedi_data_read() does not do any pausing to allow multiā
27 plexed analog inputs to settle before performing an analog to digital
28 conversion. If you are switching between different channels and need
29 to allow your analog input to settle for an accurate reading, use
30 comedi_data_read_delayed(), or set the input channel at an earlier time
31 with comedi_data_read_hint().
32
33 On sucess, comedi_data_read() returns 1 (the number of samples read).
34 If there is an error, -1 is returned.
35
36 Data values returned by this function are unsigned integers less than
37 or equal to the maximum sample value of the channel, which can be
38 determined using the function comedi_get_maxdata(). Conversion of data
39 values to physical units can be performed by the function
40 comedi_to_phys().
41
42 28 October 2007 COMEDI_DATA_READ(3)