- From: Naoko Kurahashi <naokok_at_stanford.edu>
- Date: Tue, 15 Jun 2004 18:05:46 -0700
Sorry! I got it to work. I was wondering why the positive values are exactly right while the negative values don't work. which meant that it wasn't the 2's complement afterall (I understand why the ^800 operation works to bump up everything half a range now... thank you Bernd and Frank for explaining). but if it was the 2's complement format that was giving me the problem, the positive values shouldn't work either. It turns out, that since my hardware gives data in 12bits while comedi's sampl_t is 16, if I just do &0x0fff to make sure I get just the lower 12 bits, it works fine. (I'm sorry it was something silly). but I still don't understand why only negative values screwed with the upper 4 bits I wasn't using.... Thank you for all your patient support, Naoko Quoting Frank Mori Hess <fmhess_at_users.sourceforge.net>: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > If the 2's complement stuff is confusing you, just add 2048 instead of > trying to flip bits, and it will all work out. What version of comedi > are > you using by the way? > > On Tuesday 15 June 2004 07:20 pm, Naoko Kurahashi wrote: > > Hi! > > > > Sorry, I meant to say that sampl_t in comedi is 16bits where as my ADC > > gives 12bit data (maxvalue = 4096). so I don't think I want to XOR the > > top 4 bits. Is that right? When I ^0x0800, the negative numbers turn > out > > fine but the positive ones shoot up. > > > > Naoko > > - -- > Frank > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.4 (GNU/Linux) > > iD8DBQFAz5n+5vihyNWuA4URAqw/AJ9+HSah0NNwBG22XAiCYBNvQwf+4wCgmdTP > wUtxrTQ+wacODsSpMsQwpk4= > =BPJ9 > -----END PGP SIGNATURE----- > > _______________________________________________ > comedi mailing list > comedi_at_comedi.org > https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi >
Received on 2004-06-16Z00:05:46