Removed usbdux_firmware.lst because it's just the listing of the assembler which...
[comedilib.git] / demo / sv.c
1 /*
2  * Demo of the comedi_sv_*() functions
3  * 
4  * Part of Comedilib
5  *
6  * Copyright (c) 1999,2000 David A. Schleef <ds@schleef.org>
7  *
8  * This file may be freely modified, distributed, and combined with
9  * other software, as long as proper attribution is given in the
10  * source code.
11  */
12
13 #include <stdio.h>
14 #include <comedilib.h>
15 #include <fcntl.h>
16 #include <unistd.h>
17 #include <errno.h>
18 #include <getopt.h>
19 #include <ctype.h>
20 #include <stdlib.h>
21 #include "examples.h"
22
23 comedi_t *device;
24
25
26 int main(int argc, char *argv[])
27 {
28         int ret;
29         comedi_sv_t sv;
30         double volts;
31
32         parse_options(argc,argv);
33
34         device=comedi_open(filename);
35         if(!device){
36                 comedi_perror(filename);
37                 exit(0);
38         }
39
40         if(verbose){
41                 printf("measuring device=%s subdevice=%d channel=%d range=%d analog reference=%d\n",
42                         filename,subdevice,channel,range,aref);
43         }
44
45         comedi_sv_init(&sv,device,subdevice,channel);
46
47         sv.range=range;
48         sv.aref=aref;
49         sv.n=100;
50
51         ret=comedi_sv_measure(&sv,&volts);
52         if(ret<0){
53                 comedi_perror("comedi_sv_measure()");
54                 exit(0);
55         }
56
57         printf("%g\n",volts);
58
59         return 0;
60 }
61