Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple channel scan using single task Daqmx. Same channel 2x

Hello,
    I am using a PCI-6225 card with c++ as the driver.  Right now, I am scanning the following 63 channels

"Dev1/ai55,   Dev1/ai17,   Dev1/ai34,   Dev1/ai19,   Dev1/ai36, "
   "Dev1/ai74,   Dev1/ai57,   Dev1/ai72,   Dev1/ai24,   Dev1/ai41, "
   "Dev1/ai26,   Dev1/ai43,   Dev1/ai67,   Dev1/ai50,   Dev1/ai65, "
   "Dev1/ai48,   Dev1/ai32,   Dev1/ai25,   Dev1/ai42,   Dev1/ai76, "
   "Dev1/ai59,   Dev1/ai66,   Dev1/ai49,   Dev1/ai23,   Dev1/ai16, "
   "Dev1/ai33,   Dev1/ai77,   Dev1/ai60,   Dev1/ai75,   Dev1/ai58, "
   "Dev1/ai30,   Dev1/ai47,   Dev1/ai40,   Dev1/ai70,   Dev1/ai53, "
   "Dev1/ai68,   Dev1/ai51,   Dev1/ai21,   Dev1/ai38,   Dev1/ai31, "
   "Dev1/ai79,   Dev1/ai62,   Dev1/ai69,   Dev1/ai52,   Dev1/ai20, "
   "Dev1/ai37,   Dev1/ai22,   Dev1/ai39,   Dev1/ai63,   Dev1/ai78, "
   "Dev1/ai61,   Dev1/ai27,   Dev1/ai44,   Dev1/ai29,   Dev1/ai46, "
   "Dev1/ai64,   Dev1/ai71,   Dev1/ai54,   Dev1/ai18,   Dev1/ai35, "
   "Dev1/ai28,   Dev1/ai45,   Dev1/ai73";

The problem is that I want to insert a ground channel, Dev1/ai56 inbetween each of these.  This way the array would look like this

                    "Dev1/ai56, Dev1/ai55, Dev1/ai56, Dev1/ai17, Dev1/ai56, Dev1/ai34, Dev1/ai56, Dev1/ai19, Dev1/ai56, Dev1/ai36"
"Dev1/ai74, Dev1/ai56, Dev1/ai57, Dev1/ai56, Dev1/ai72, Dev1/ai56, Dev1/ai24, Dev1/ai56, Dev1/ai41"
"Dev1/ai26, Dev1/ai56, Dev1/ai43, Dev1/ai56, Dev1/ai67, Dev1/ai56, Dev1/ai50, Dev1/ai56, Dev1/ai65"
"Dev1/ai48, Dev1/ai56, Dev1/ai32, Dev1/ai56, Dev1/ai25, Dev1/ai56, Dev1/ai42, Dev1/ai56, Dev1/ai76"
"Dev1/ai59, Dev1/ai56, Dev1/ai66, Dev1/ai56, Dev1/ai49, Dev1/ai56, Dev1/ai23, Dev1/ai56, Dev1/ai16"
"Dev1/ai33, Dev1/ai56, Dev1/ai77, Dev1/ai56, Dev1/ai60, Dev1/ai56, Dev1/ai75, Dev1/ai56, Dev1/ai58"
"Dev1/ai30, Dev1/ai56, Dev1/ai47, Dev1/ai56, Dev1/ai40, Dev1/ai56, Dev1/ai70, Dev1/ai56, Dev1/ai53"
"Dev1/ai68, Dev1/ai56, Dev1/ai51, Dev1/ai56, Dev1/ai21, Dev1/ai56, Dev1/ai38, Dev1/ai56, Dev1/ai31"
"Dev1/ai79, Dev1/ai56, Dev1/ai62, Dev1/ai56, Dev1/ai69, Dev1/ai56, Dev1/ai52, Dev1/ai56, Dev1/ai20"
"Dev1/ai37, Dev1/ai56, Dev1/ai22, Dev1/ai56, Dev1/ai39, Dev1/ai56, Dev1/ai63, Dev1/ai56, Dev1/ai78"
"Dev1/ai61, Dev1/ai56, Dev1/ai27, Dev1/ai56, Dev1/ai44, Dev1/ai56, Dev1/ai29, Dev1/ai56, Dev1/ai46"
"Dev1/ai64, Dev1/ai56, Dev1/ai71, Dev1/ai56, Dev1/ai54, Dev1/ai56, Dev1/ai18, Dev1/ai56, Dev1/ai35"
"Dev1/ai28, Dev1/ai56, Dev1/ai45, Dev1/ai56, Dev1/ai73";

Howeverm I get error -200489 that states it cannot have the same channel name in the tasks scan order.  What is the best approach to solve this problem?  Right now I am using
DAQmxReadBinaryI16 to read 63 channels at 2000hz with 2000 samples per channel.

My concern is that my test setup only injects one channel at a time.  I think there is some stray capacitance lingering on the AD conversion because the channel right after the one being injected is picking up  nearly the same signal.  If I ground this next channel, I also see the same signal on some other channel.  I am trying to decipher if there is some kind of cross talk on the cable.

Thank you
0 Kudos
Message 1 of 7
(6,145 Views)

If your concern is the “stray capacitance” you might consider changing to shielded cabling. Also refer to this DevZone article for more information: Field Wiring and Noise Considerations for Analog Signals.  It seems that you are experiencing what we call, ghosting.  One of the best resources to look will be:  Troubleshooting Unexpected Voltages, Floating, or Crosstalk on Analog Input Channels. As you can see one of the solutions is to scan a ground channel between your channel of interest but as far as I know you can not read the same channel over and over again, and this is exactly what you are trying to do. There is a lot of good information in the Troubleshooting page C-1

I hope it helps any question please post back.



Message Edited by Jaime F on 11-16-2007 05:50 PM
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 2 of 7
(6,123 Views)
Hello,
    Thank you for getting back to me.  You are correct that I am worried about this 'ghosting' issue.  I do not have enough spare analog inputs to do an every-other ground via different channels.  Could I break away the single Binary read into different tasks for all my 63 channels and just loop the readings inbetween channel 56 (my grounded channel)?  If this assumption is correct, do you know where I could get an example of this (I've never done multiple tasks, only a single task for multiple channel handling).

Thank you,
0 Kudos
Message 3 of 7
(6,104 Views)

Unfortunately since there is one sample clock for all the analog inputs the DAQmx driver will not allow you to do multiple task at the same time, because there is only one timing engine for the 80 analog inputs the only way you can accomplish this is by starting and stopping the task every time you read a channel and the grounded channel. I’m sorry to inform that we don’t have an example that will handle this algorithm; mainly because, the solution for this problem should be more hardware oriented than software.

Some consideration to take: Have you checked if your source is low impedance? Like one of the article said: If multiplexed systems are driven by sources with high source impedance, you may see voltages from one scanned channel reflected on another scanned channel.

Reading the ground channel in between can be substituted by reducing the “sampling rate”, take a look at this knowledgebase for more information: How do I Increase Interchannel Delay Using NI-DAQmx or Traditional NI-DAQ (Legacy)?.

I hope it helps

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 4 of 7
(6,087 Views)
Hi sparckis,

E Series and M Series boards support repeating the same physical channel multiple times in the same task (for AI). In fact, that's how multiplexed SCXI works: all of the channels in the first SCXI chassis map to Dev1/ai0 on the digitizer, so a typical multiplexed SCXI task will contain many repeated physical channels.

However, DAQmx does not support repeating the same virtual channel name multiple times in the same task. Each instance of the physical channel Dev1/ai56 must have a unique virtual channel name. Passing an empty string for the nameToAssignToChannel parameter of DAQmxCreateAIVoltageChan() causes DAQmx to set the virtual channel name to be the same as the physical channel name, so your program is probably trying to create multiple channels named "Dev1/ai56" and failing.

If you pass the string "myChannel" for the nameToAssignToChannel parameter, DAQmx will name your channels "myChannel0" through "myChannel199" (or however many channels you are creating). You can get complete control over the virtual channel naming by calling DAQmxCreateAIVoltageChan() multiple times, creating one channel per call. When you create one channel at a time, DAQmx does not append a number to your virtual channel names.

Brad
---
Brad Keryan
NI R&D
0 Kudos
Message 5 of 7
(5,939 Views)

Thanks, BradK, for the summary of how to do this.   I interpreted your instructions to help me make a loop in LabVIEW 8.5 and finally got the errors out.  In my case, I'm updating code from before DAQmx, where there was no problem putting a channel into a list multiple times.  What finally cleared the error messages was to put my list of physical channels into a loop with indexing enabled.  Inside the loop is the DAQmx function "DAQmx Create Channel (AI Voltage Basic).vi".  I was also able to put in a array of voltage ranges.  I used the loop counter to generate unique strings for the "name to assign" input (without this, the errors persist).  To verify that my channels got into the task, I put in a Task Node (from NI-DAQmx>>Advanced>>I/O Constants), chose the property "Channels", and wired this to an indicator.  The task output from this loop wires to the DAQmx Timing (Sample Clock).vi VI. 

0 Kudos
Message 6 of 7
(5,209 Views)

I found that the key is to give each channel a name (usually I just ignore that step), and that furthermore that name is unique. See attached image. 

 

Does this work for you?

 

LabView-repeat-scanning.PNG

 

 

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