fixed bit mangling in analog input read insn for 16 bit das802/16
authorFrank Mori Hess <fmhess@speakeasy.net>
Tue, 19 Jun 2001 16:16:35 +0000 (16:16 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Tue, 19 Jun 2001 16:16:35 +0000 (16:16 +0000)
comedi/drivers/das800.c

index 32e56cc2808b8db3f7e692245bbc566d501f43c7..c426daf4b2780d3fc5b03b3d073a9b184165358f 100644 (file)
@@ -858,7 +858,14 @@ static int das800_ai_rinsn(comedi_device *dev, comedi_subdevice *s, comedi_insn
                }
                lsb = inb(dev->iobase + DAS800_LSB);
                msb = inb(dev->iobase + DAS800_MSB);
-               data[n] = (lsb >> 4) | (msb << 4);
+               if(thisboard->resolution == 12)
+               {
+                       data[n] = (lsb >> 4) & 0xff;
+                       data[n] |= (msb << 4);
+               }else
+               {
+                       data[n] = (msb << 8) | lsb;
+               }
        }
 
        return n;