Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

6010 examples

I am working with a PCI6010 in linux. Having read some about this device on this board, it has been noted that the 6010 should be identical to the 622x for analog in.

 

I have the M-series examples built, the kernel module inserted, and the right bus and slot address in the "PXIn::n::INSTR" string so the card mmap's correctly.

 

Running the AI examples, I'm not able to read any voltage on any channel (always returns 0.0, have 3-ish volts on AI0) and there are apparently no error messages or failures that I can tell.

 

Should these examples need any further modification to work with this card? I will also eventually need control of DIO and counter out (pulse train), but not analog out. Which examples should I use for this? I tried the 'gpctex5.cpp' that I found on a previous post and did not see any pulses out using that either.

 

Thanks

0 Kudos
Message 1 of 7
(7,808 Views)

When I started with DDK (nimddk_other) programming I had a similar problem, and it turned out to be an endian issue. As a matter of fact, the eeprom at the NI board stores the values (e.g. serial number and scaling coefficients) in big-endian. At my first try-outs, I read the scaling coefficients on a little endian machine that did not swap the bytes, and it resulted in all AI readings being zero.

 

I cannot tell for nimddk_linux but in the file OSITypes.h at line 67 of nimddk_other, there is a note that we have to define kLittleEndian=1 or kBigEndian=1 in the OS specific makefile or project.

 

Once I took care about the endianess, everything worked well.

 

Best regards

 

Rolf

0 Kudos
Message 2 of 7
(7,799 Views)
I have kLittleEndian defined to 1 in the module makefile, and this is a little endian (x86) machine. Unless this doesn't mean what it appears to, it should be correct.
0 Kudos
Message 3 of 7
(7,781 Views)

I had a look at osiTypes.h of nimhddk_linux26. I found the 2 byte swapping routines looking so extremely sophisticated that I can't figure out if they do the right thing, I haven't found the time for an in-deep analysis, though. Perhaps you want to replace the sophisticated ones with the following simplistic routines, which are guaranteed to do that what they are looking like what they are doing - swapping the bytes:-)

 

inline u32 SwitchEndianU32(u32 x)

{

   u32 result;

   char *p = (char *)&x;

   char *q = (char *)&result;

   

   q[0] = p[3];

   q[1] = p[2];

   q[2] = p[1];

   q[3] = p[0];

   

   return result;

}

 

inline u16 SwitchEndianU16(u16 x)

{

   u16 result;

   char *p = (char *)&x;

   char *q = (char *)&result;

   

   q[0] = p[1];

   q[1] = p[0];

    

   return result;

}

 

If your code is for x86 for ever and if you are compiling with gcc, then you can replace the second routine with:

 

inline u16 SwitchEndianU16(u16 x)

{

   __asm__("xchgb %b0, %h0" : "+q" (x));

   return x;

}

 

Best regards

 

Rolf 

0 Kudos
Message 4 of 7
(7,774 Views)

That's just an xor swap

 

http://en.wikipedia.org/wiki/XOR_swap_algorithm

 

which should do the right thing. Didn't recognize it right away either.

 

I'm just looking at the unscaled counts now. Almost always 32761 (wiggles randomly) whether there's 0V or 4ish V going in. The pin should be correct since it is the one I've used for ai0 in DAQmx on the same computer and card.

 

I'm also passing in a nMDBG::tStatus2 to some of the functions that optionally take it. Is there an error/success code map somewhere? I see that negative status values are errors.

 

Thanks

 

 

0 Kudos
Message 5 of 7
(7,765 Views)

Hi Dave-

 

I don't have a 6010 set up at my desk, but here are a couple of tips that might be worth trying:

 

Make sure you're not executing the adcReset() command as shown in the M Series AI examples.  As you probably saw from the comments, that command is only needed for 625x devices.

AI Convert polarity (specified in aiPersonalize()) should be active high.

Which values are you supplying to aiConfigureChannel() for polarity, etc?

 

 

Tom W
National Instruments
0 Kudos
Message 6 of 7
(7,702 Views)

I've tried several different gain ranges, knowing that the 6010 maxes out at +-5. '5' and '4' seemed to be universal according to ai.h, but any number I put in there didn't seem to make any difference.

 

Yes, I was calling adcReset. Hadn't noticed that I shouldn't.

 

I have also tried Bipolar and Unipolar, and Differential and NRSE (didn't expect diff to help much since I'm only connecting up one channel)

 

I'm playing with DAQmx again at the moment, so I can't really try this out. The motivation for using the DDK is to have better control over the counter out specifically. In the old DAQ7, there was a way to program two different dutys and command the channel to switch on the 'next' cycle, which I can't seem to do with mx. Maybe that's a better question to be asking.

 

Thanks

0 Kudos
Message 7 of 7
(7,697 Views)