- From: Bernd Porr <BerndPorr_at_f2s.com>
- Date: Thu, 07 Jun 2007 15:24:24 +0100
Interesting twist putting the comedi_get_buffer_contents in the read
command. I actually always just read one set of samples from the buffer
and loop through. Never tried to read bigger chunks (from qtscope):
while (comedi_get_buffer_contents(comediDevice,comediSubdevice)) {
// read data from device
if (read(comedi_fileno(comediDevice),
dataBuffer, n_chan*sizeof(sampl_t)) == 0) {
cerr << "Error: end of Aquisition\n";
comediError=-1;
return;
}
if( num < MAX_DATA_BUFFER ) {
// fill the data buffer
for( i = 0; i < n_chan; i++)
convDataBuffer[i][num] =
comedi_to_phys(((sampl_t *)dataBuffer)[i],myRanges[i],maxdata);
num++;
} else cout << "data buffer
overflow\n";cout.flush();
}
/Bernd
www: http://www.berndporr.me.uk/
http://www.linux-usb-daq.co.uk/
Mobile: +44 (0)7840 340069
Work: +44 (0)141 330 5237
University of Glasgow
Department of Electronics & Electrical Engineering
Room 519, Rankine Building, Oakfield Avenue,
Glasgow, G12 8LT
Georg Michel wrote:
> Hi List,
>
> I have a problem with the USBDUX-fast comedi driver (or the USBDUX-fast
> firmware?). I use Kernel 2.6.19.7 with RTAI 3.5 and RTAI-enabled Comedi
> from CVS:
>
> When using a comedi command for acquisition, I get the last half
> of the received data zero padded on many reads. Sometimes the read
> operation returns only zeroes. Nevertheless, the data rate
> corresponds to the sampling interval which was defined by the
> comedi command. Sometimes I can reduce this effect by selecting
> a proper timing between the reads or between the first read and
> the subsequent reads. But it is hard to eliminate this effect
> completely. The effect is more moderate if I wait for some time
> between the first and the subsequent reads. To read the data I
> use: read(comedi_fileno(dev),(unsigned char*)buffer,
> comedi_get_buffer_contents(dev,subdevice))). If I first do a
> comedi_get_buffer_contents and then wait a little and read with
> the previously obtained buffer size, the effect is the same.
>
> Do other people have the same problem and is there a known workaround or
> even a fix to this? Thanks for your time.
>
> Best Regards
> Georg
>
>
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi
>
Received on 2007-06-07Z13:24:24