- From: Fredik Lingvall <fl_at_signal.uu.se>
- Date: Mon, 18 Nov 2002 08:55:42 +0100
Hi all!
This is the output of the monitor program directly after
insmod:ing the ni_labpc module:
Sun Nov 17 19:27:35 2002 CET +013028us
channel data
ai 0:0:00 gnd -4.8045(24)
ai 0:0:01 gnd -4.8045(24)
ai 0:0:02 gnd -4.8045(24)
ai 0:0:03 gnd -4.8045(24)
ai 0:0:04 gnd -4.8045(24)
ai 0:0:05 gnd -4.8045(24)
ai 0:0:06 gnd -4.8045(24)
ai 0:0:07 gnd -4.8045(24)
ao 0:1:00 -0.001221
ao 0:1:01 -0.001221
dio 0:2:00 1111 1111
The measured voltage on both outputs (DAC0OUT and DAC1OUT) is about 0.7
V not
0 V. It is also strange that the analog inputs have the same value. The
inputs are not
connected so there should be some small random values on the inputs (noise).
Running outp program (from the comedilib demo dir):
./outp 0 -v -s 1 -r 0 -c 0
writing 0 to device=/dev/comedi0 subdevice=1 channel=0 range=0 analog
reference=0
0
don't give the correct voltage on the outout on DAC0. The voltage
actually changes
when I run outp with the same arguments several times. I have noticed a
similar behavior
on the analog inputs using a mex-file that I wrote (for Matlab).
This is a part of the mex-file:
//*************************************
//
// Open the DAQ device.
//
it = comedi_open("/dev/comedi0");
if (it <= 0)
mexErrMsgTxt("Error opening data aquisition device!");
subdev = 0;
n_chans = comedi_get_n_channels(it,subdev); // Get number of channels.
cr = comedi_get_range(it, subdev, chan, range); // Get ADC range.
maxdata = comedi_get_maxdata(it, subdev, 0); // Get max ADC value.
//
// Create a matrix for the return argument.
//
if (nOUT <=1) {
OUTs[0] = mxCreateDoubleMatrix(n_chans, 1, mxREAL);
v = mxGetPr(OUTs[0]); // Get Pointer to real part.
}
else {
mexErrMsgTxt("One output argument expected!.");
}
comedi_loglevel(1);
//
// Read all channels.
//
for (chan=0; chan<n_chans; chan++) {
err = comedi_data_read(it,subdev,chan,range,aref,&data); // Read data.
if (err==-1)
comedi_perror("comedi_data_read");
v[chan] = comedi_to_phys(data,cr,maxdata); // Convert to voltage.
}
comedi_close(it);
//*******************************
The voltage is sometimes measured correctly and sometimes not (when I run
the mex-file several times).
I use comedi-0.7.65 and comedilib-0.7.19. Do anyone know what
the problem is?
Fredrik
Received on 2002-11-18Z07:55:42