Re: NI 6259 - Strange values for positive input voltate on analog in

Hi Dave,

thanks for your reply!
>> Whenever the input voltage is negative, the value of data in comedi_data_read() is fine,
>> it is something between 0x00000000 and 0x00007fff.
>> However, whenever the input voltage is positive, the higher two bytes of data become 0xffff, 
>> the values are 0xffff8000 (for 0V) up to 0xffffffff (5V which is the maximum here).
>> It looks as if the higher two bytes get set to 0xffff whenever the voltage becomes positive.
>
>Sounds like a the lsampl_t value obtained from comedi_data_read() is 
>somehow getting treated as a signed value that is then cast to a signed 
>32-bit value somewhere.   Can you post a code snippet that shows how 
>you're using comedi_data_read and the variable that gets the data.

That was my first idea aswell. However, I deeped into the kernel driver and did a rt_printk there.

In ni_mio_common (CVS version) at line 1378 I do a:
                        if(boardtype.reg_type == ni_reg_m_series)
                        {
                                data[n] = ni_readl(M_Offset_AI_FIFO_Data);
                                rt_printk("ni_mio_common: %i: data[n]==%x\n", __LINE__, data[n]);
                                data[n] += signbits;
                        }else
                        {
                                d = ni_readw(ADC_FIFO_Data_Register);
                                d += signbits; /* subtle: needs to be short addition */
                                data[n] = d;
                        }
For a positive input value (+0.5V) data[n] is ffff8c57,
for a negative input value (-0.5V) data[n] is 73d2

Here the strange effect comes up. I have the assumption that the ni_readl reads in  a 32 bit value
but only 16 bits are valid and the other bits are undefined. This could make sense as the 6259
is specified to have a 16bit AD converter, thus there is no need to write more than these 16bits
to the register.

Are there any other NI M-series AD boards in use that show the same effect?

Thanks for any feedback on this issue!

Regards

Mathias


-- 
Mathias Koehrer
mathias_koehrer_at_arcor.de


Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig
und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer,
nur  44,85 €  inkl. DSL- und ISDN-Grundgebühr!
http://www.arcor.de/rd/emf-dsl-2

Received on 2006-10-06Z07:38:24