Problems with PCI-6713 board from National Instruments

The Analog Outputs have wrong output voltage.

I writte the following comedi data with the "comedi_data_write" function.

desired value  /  output value  /  comedi data

-10V  /  0V  /  0
-8V  /  2V  /  410
-6V  / 4V  /  819
-5V  /  5V  /  1024
-3V  /  7V  /  1433
0V  / 10V  /  2048
2V  /  -8V  /  2457
4V  /  -6V  /  2867
5V  /  -5V  /  3071
10V  /  0V  /  4095

The other boards i.e. PCI-6703 have the right output values.
The following function uses the PCI-6703 board (comedi driver file
"ni_mio_common.c"):

static int ni_ao_insn_write(comedi_device *dev,comedi_subdevice *s,
    comedi_insn *insn,lsampl_t *data)
{
    unsigned int chan = CR_CHAN(insn->chanspec);
    unsigned int invert;

    invert = ni_ao_config_chanlist(dev,s,&insn->chanspec,1);

    devpriv->ao[chan] = data[0];

    ni_writew(data[0] ^ invert,(chan)? DAC1_Direct_Data : DAC0_Direct_Data);

    return 1;
}

The PCI-6713 use the following function:

static int ni_ao_insn_write_671x(comedi_device *dev,comedi_subdevice *s,
    comedi_insn *insn,lsampl_t *data)
{
    unsigned int chan = CR_CHAN(insn->chanspec);

    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));

    return insn->n;
}
#define ao_win_out(a,b) do{ \
    ni_writew((b),AO_Window_Address_671x); \
    ni_writew((a),AO_Window_Data_671x); \
}while(0)

In the function "ni_ao_insn_write_671x" I missing the bitwise exclusive OR
combination from "data" with "invert" (invert = 2^(ao_bits-1)).

This combination make the following values:

0  ->  2048
500  ->  2548
1000  ->  3048
2047  ->  4095
2048  ->  0
2500  ->  452
3000  ->  952
3500  ->  1452
4095  ->  2047

I think that is the reason for the wrong output values with the PCI-6713
board. Is this a bug from the comedi "ni_pcimio " module???

Markus

Received on 2002-09-19Z13:06:00