LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C series multi device task

Hi all,

 

I am trying to declare multiple ai channels on a cDAQ system.  I tried using the DAQmx create channel subvi sending in the following command as physical channels cDAQMod1/ai0,cDAQMod1/ai1,cDAQMod1/ai2 but the program errors out on the DAQmx Read subvi.  I have used this same command structure, such as Dev1/ai0,Dev1/ai1, on PCI cards that were physically in the computer which communicated with a BNC-2110 box and the program ran fine.  If I declare the physical channels interdependently, the programs works fine, but I have at least 20 different channels to declare.  Has anything changed in the way cDAQ has to be declared?

 

Cheers,

Shivels 

0 Kudos
Message 1 of 6
(4,457 Views)

Hi Shivels,

 

Some additional information would be very helpful. What was the error message? Which models of modules and chassis are you using? When you call the DAQmx Create Channel VI independently for each channel, are you using different polymorphic instances of that VI (such as AI Voltage, AI Current, and AI Strain Gage) for different channels?

 

This is only a guess, but perhaps one of the modules requires you to configure a sample clock (like the NI 923x) or doesn't support voltage measurements (like the NI 9203 or NI 9235/6/7).

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 6
(4,443 Views)

Hi Brad,

 

Thanks for taking the time to help. I’m using Ni cDAQ-9178 and modules are Ni 9205 voltage, Ni 9203 Current, Ni 9213 Temperature, Ni 9234 accelerometers in that order. I have enclosed two pictures in DAQ declared shows how I’m declaring them with the string cDAQ1Mod1/ai0, cDAQ1Mod1/ai1 for the voltage cDAQ1Mod2/ai0 for the current and so on. The DAQ subvi picture is where the actual error is occurring. The error message says error – 200478 occurred at DAQmx READ (ANALOG 2D DBL NChan Nsam).vi : 1. For my testing I have hooked up the proper supplies to all the modules so it all should read correctly once I get this problem solved. I’m not familiar with how to configure the sample clock please explain.   

 

Thanks for your time.

Shivels23028i4F013BDF6972CC7423030i04A238C3299A8D77

0 Kudos
Message 3 of 6
(4,428 Views)

Hi shivels,

 

Error -200478 has the description "Specified operation cannot be performed when there are no channels in the task." It sounds like your "task/channels in" control contains a blank task name. DAQmx Read will automatically create an empty task when you pass it a blank task name.

 

The other thing you'll run into is that the cDAQ-9178 can run up to three analog input tasks at one time, but you have four. You need to combine some of your tasks by adding channels from multiple modules to the same task. If you want everything to run at a fast rate, you could do this:

 

23036i187A3D1158F4C771

 

Note that the NI 9213 can't keep up with 51200 S/s, so it will return repeated data. But you could split the NI 9213 into a separate task:

 

23038i9EDBF40D93DDEAA8

 

Also note that the DAQmx Create Task VI is optional--if you leave it out, DAQmx Create Channel will automatically create a task for you.

 

Brad

 

---
Brad Keryan
NI R&D
0 Kudos
Message 4 of 6
(4,419 Views)

Brad,

 

I went ahead and did as you said. I'm still not reading anything from the 9213 thermocouples but 9234 accelerometer is reading now  but as zero only no real value. The accelerometers should be reading 2 volts cause thats what I'm suppling to them. I look at the settings for the accelerometer and I set the input termal to pseudodiffer do I need to set it to DC and if so how do I do that. I tested both 9213 and 9234 with the test panel in measurement and automation and 9234 read the correct values when set to pseudodiffer and DC. 9213 however only gave me the max limit and wasn't changing at all  So what would be the correct settings for 9213 I have a type K thermocouple.The picture below show how I wired the DAQ up based from your picture. If you could please check and make sure I didn't miss anything. What should I do at this point?

 

Thanks for your time,

Shivels  

23154i2CA8FCC4AD2F6E08

0 Kudos
Message 5 of 6
(4,389 Views)

Hi Shivels,

 

The point I was trying to get across with those VI snippets was that you should connect the "task out" from one DAQmx Create Channel VI to the "task in" on the next one in order to put the channels in the same task. Sorry I didn't make that more clear. The screenshot you just posted creates five separate tasks.

 

As for the 2 V reading, creating an AI Accelerometer channel enables AC coupling and IEPE excitation. You could change the coupling to DC, but you would also have to disable the excitation because the NI 9234 doesn't support DC coupling and IEPE excitation at the same time. Is the 2 V voltage source just for testing?

 

Other problems you will run into with this code:

  • cDAQ1Mod4/Tc0 will give you an error because the channel name in DAQmx is cDAQ1Mod4/ai0.
  • You need to wire the last "task out" for each task to a DAQmx Start and a DAQmx Read VI.

I'd recommend starting out using the DAQmx example VIs to do each measurement separately, make sure they are all working in isolation, and then combine them. Or start by using the DAQ Assistant (which also lets you put voltage, current, and acceleration channels in the same task).

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 6 of 6
(4,383 Views)