1COMEDI_DATA_READ(3) Comedi reference 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,
13 unsigned int aref, lsampl_t * 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 stores the value in *data.
25
26 WARNING: comedi_data_read does not do any pausing to allow multiplexed
27 analog inputs to settle before starting an analog to digital
28 conversion. If you are switching between different channels and need to
29 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 Data values returned by this function are unsigned integers less than
34 or equal to the maximum sample value of the channel, which can be
35 determined using the function comedi_get_maxdata. Conversion of data
36 values to physical units can be performed by the functions
37 comedi_to_phys (linear conversion) or comedi_to_physical (non-linear
38 polynomial conversion).
39
41 On success, comedi_data_read returns 1 (the number of samples read). If
42 there is an error, -1 is returned.
43
45 David Schleef <ds@schleef.org>
46 Author.
47
48 Frank Mori Hess <fmhess@users.sourceforge.net>
49 Author.
50
51 Herman Bruyninckx <Herman.Bruyninckx@mech.kuleuven.ac.be>
52 Author.
53
54 Bernd Porr <tech@linux-usb-daq.co.uk>
55 Author.
56
57 Ian Abbott <abbotti@mev.co.uk>
58 Author.
59
60 Éric Piel <piel@delmic.com>
61 Author.
62
64 Copyright © 1998-2003 David Schleef
65 Copyright © 2001-2003, 2005, 2008 Frank Mori Hess
66 Copyright © 2002-2003 Herman Bruyninckx
67 Copyright © 2012 Bernd Porr
68 Copyright © 2012 Ian Abbott
69 Copyright © 2012, 2015 Éric Piel
70
71 This document is part of Comedilib. In the context of this document,
72 the term "source code" as defined by the license is interpreted as the
73 XML source.
74
75 This library is free software; you can redistribute it and/or modify it
76 under the terms of the GNU Lesser General Public License as published
77 by the Free Software Foundation, version 2.1 of the License.
78
79 This library is distributed in the hope that it will be useful, but
80 WITHOUT ANY WARRANTY; without even the implied warranty of
81 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
82 General Public License for more details.
83
84 You should have received a copy of the GNU Lesser General Public
85 License along with this library; if not, write to the Free Software
86 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
87 USA.
88
89
90
91
92Comedi 05/11/2017 COMEDI_DATA_READ(3)