Re: NI PCI-6713 signed vs unsigned bug

On Fri, Jul 05, 2002 at 03:01:40PM +0200, Peter Soetens wrote:
> Hi,
> 
> We are testing our NI PCI-6713 board and it seems that the data is send as 
> signed instead of unsigned numbers to the card.
> 
> for example:
> outp -s 1 -c 0 2047  ==> gives +10V
> outp -s 1 -c 0 2048  ==>  gives  -10V
> outp -s 1 -c 0 0        ==> gives 0 V
> 
> We tried to trace it where this conversion could have failed (we don't 
> experience it with our other NI boards, same kernel module), but got a bit 
> lost in the ioctl calls.
> 
> Could you provide any hint where it might have failed ? Personally i think an 
> (unsigned int) cast is missing somewhere.

This should fix it.



dave...


Index: ni_mio_common.c
===================================================================
RCS file: /var/cvs/comedi/comedi/drivers/ni_mio_common.c,v
retrieving revision 1.137
diff -u -r1.137 ni_mio_common.c
--- ni_mio_common.c	7 Jun 2002 00:02:40 -0000	1.137
+++ ni_mio_common.c	5 Jul 2002 18:19:35 -0000
_at__at_ -1855,11 +1855,14 _at__at_
 	comedi_insn *insn,lsampl_t *data)
 {
 	unsigned int chan = CR_CHAN(insn->chanspec);
+	lsampl_t d;
 
 	ni_ao_config_chanlist(dev,s,&insn->chanspec,1);
 
-	devpriv->ao[chan] = data[insn->n-1];
-	ao_win_out(data[insn->n-1],DACx_Direct_Data_671x(chan));
+	d = data[insn->n-1];
+	devpriv->ao[chan] = d;
+	d -= 1 << (boardtype.aobits - 1);
+	ao_win_out(d,DACx_Direct_Data_671x(chan));
 
 	return insn->n;
 }

Received on 2002-07-05Z17:22:38