random cleanup
This commit is contained in:
parent
7cde371fd4
commit
46247c4783
1 changed files with 17 additions and 23 deletions
40
demo/tut2.c
40
demo/tut2.c
|
@ -9,34 +9,28 @@
|
|||
* source code.
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for printf() */
|
||||
#include <stdio.h> /* for printf() */
|
||||
#include <comedilib.h>
|
||||
|
||||
int subdev = 0; /* change this to your input subdevice */
|
||||
int chan = 0; /* change this to your channel */
|
||||
int range = 0; /* more on this later */
|
||||
int aref = AREF_GROUND; /* more on this later */
|
||||
int subdev = 0; /* change this to your input subdevice */
|
||||
int chan = 0; /* change this to your channel */
|
||||
int range = 0; /* more on this later */
|
||||
int aref = AREF_GROUND; /* more on this later */
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
comedi_t *cf;
|
||||
int chan=0;
|
||||
int data;
|
||||
int maxdata;
|
||||
double volts;
|
||||
comedi_t *cf;
|
||||
lsampl_t data;
|
||||
int maxdata;
|
||||
double volts;
|
||||
comedi_range *cr;
|
||||
|
||||
cf=comedi_open("/dev/comedi0");
|
||||
cf = comedi_open("/dev/comedi0");
|
||||
maxdata = comedi_get_maxdata(cf, subdev, chan);
|
||||
cr = comedi_get_range(cf, subdev, chan, range);
|
||||
comedi_data_read(cf, subdev, chan, range, aref, &data);
|
||||
volts = comedi_to_phys(data, cr, maxdata);
|
||||
printf("%d %g\n", data, volts);
|
||||
|
||||
maxdata=comedi_get_maxdata(cf,subdev,chan);
|
||||
|
||||
cr=comedi_get_range(cf,subdev,chan,range);
|
||||
|
||||
comedi_data_read(cf,subdev,chan,range,aref,&data);
|
||||
|
||||
volts=comedi_to_phys(data,cr,maxdata);
|
||||
|
||||
printf("%d %g\n",data,volts);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue