5 * Copyright (c) 1999,2000 David A. Schleef <ds@schleef.org>
7 * This file may be freely modified, distributed, and combined with
8 * other software, as long as proper attribution is given in the
12 #include <stdio.h> /* for printf() */
13 #include <comedilib.h>
15 int subdev = 0; /* change this to your input subdevice */
16 int chan = 0; /* change this to your channel */
17 int range = 0; /* more on this later */
18 int aref = AREF_GROUND; /* more on this later */
20 int main(int argc, char *argv[])
28 cf = comedi_open("/dev/comedi0");
29 maxdata = comedi_get_maxdata(cf, subdev, chan);
30 cr = comedi_get_range(cf, subdev, chan, range);
31 comedi_data_read(cf, subdev, chan, range, aref, &data);
32 volts = comedi_to_phys(data, cr, maxdata);
33 printf("%d %g\n", data, volts);