Re: negative voltage reading problem with cmd.c and ni_pcimio

Hi!

Seems so that the sign bit of the converter is not interpreted in the 
right way. Comedi uses unsigned data but some A/D converters give the 
data in two-complement form. The driver should "undo" this by XOR the 
appropriate bit(s):

comedi_buf_put(s->async,(this_usbduxsub->inBuffer[i])^0x800);

Might be a bug in the driver.

/Bernd

www:    http://www.berndporr.me.uk/
         http://www.linux-usb-daq.co.uk/
Mobile: +44 (0)7769 506746
Work:   +44 (0)141 330 5237
         Department of Electronics & Electrical Engineering
         Room 519, Rankine Building, Oakfield Avenue,
         Glasgow, G12 8LT


Naoko Kurahashi wrote:
> Hi, 
> I've been battling a weird problem today of not being able to acquire
> negative voltage values with my NI PCI MIO card. When executing the cmd demo
> program, for example, every time the input voltage is < 0, the acquired
> value shoots up to 63000 or so (max res for my card is 4096). I have my
> range set to 3 (bipolar +/-1V). when I set it to unipolar 0-5V, the negative
> values just give 0 and everything looks fine.
> 
> Maybe my problem is hardware related, or I'm just missing something very
> simple because I'm very tired, but I am out of things to try. Please let me
> know if you have any suggestions or have experienced similar problems.
> 
> Thank you,
> Naoko Kurahashi
> 
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi

Received on 2004-06-15Z08:15:51