- From: Eric Hudson <ehudson_at_midlandhome.net>
- Date: Thu, 24 Feb 2005 14:33:17 -0600
Hi all,
I finally got around to connecting my analog device to my card (Measurement
Computing PCI-DAS6034) and I get invalid output. The output from my analog
device while running showed 64.1mV and my modified version of demo/tut2 showed
1073833120 16385.1
Why is this? I have included below my modified tut2.c program and the output
from demo/info hopefully you all can help me figure this out.
Thanks,
Eric .
///////////////// Modified tut2.c program /////////////////////////////
* Modified tutorial example #2
* Part of Comedilib
*
* Copyright (c) 1999,2000 David A. Schleef <ds_at_schleef.org>
*
* This file may be freely modified, distributed, and combined with
* other software, as long as proper attribution is given in the
* source code.
*/
#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 = 2; /* more on this later */
int aref = AREF_DIFF; /* more on this later */
//int aref = 0; /* more on this later */
int main(int argc, char *argv[])
{
comedi_t *cf;
lsampl_t data;
int maxdata;
double volts;
comedi_range *cr;
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);
return 0;
}
// Modified tutorial example #2 output
// daq:/mla# ./m_tut2
// 1073833120 16385.1
//////////// end modified tut2.c ///////////////////////
/////////// output from demo/info //////////////////////
overall info:
version code: 0x000745
driver name: cb_pcidas64
board name: pci-das6034
number of subdevices: 10
subdevice 0:
type: 1 (analog input)
number of channels: 16
max data value: 65535
ranges:
all chans: [-10,10] [-5,5] [-0.5,0.5] [-0.05,0.05]
command:
start: now|ext
scan_begin: follow|timer
convert: timer|ext
scan_end: count
stop: none|count|ext
command fast 1chan:
start: now 0
scan_begin: follow 0
convert: timer 5000
scan_end: count 1
stop: count 2
subdevice 1:
type: 0 (unused)
subdevice 2:
type: 0 (unused)
subdevice 3:
type: 0 (unused)
subdevice 4:
type: 5 (digital I/O)
number of channels: 24
max data value: 1
ranges:
all chans: [0,5]
command:
not supported
subdevice 5:
type: 5 (digital I/O)
number of channels: 8
max data value: 1
ranges:
all chans: [0,5]
command:
not supported
subdevice 6:
type: 9 (calibration)
number of channels: 8
max data value: 255
ranges:
all chans: [0,1]
command:
not supported
subdevice 7:
type: 0 (unused)
subdevice 8:
type: 8 (memory)
number of channels: 128
max data value: 65535
ranges:
all chans: [0,1]
command:
not supported
subdevice 9:
type: 0 (unused)
//////////////////////// end demo/info output ////////////////////
Received on 2005-02-24Z20:33:17