LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring DAQ channels through LabView program

Hi,

I want to scan one analog input of PCI 6025E every 250 msec and I scan 8 such channels. I am using AI Sample Channel VI to do this and for its channel input I am feeding a string (with channel name) that is typecasted using a Traditional DAQ channel constant. All the required channels are configured using this constant. However this VI doesn't seem to be portable. When I use it on a different machine, the constant shows no channels defined.

Is there a way to configure DAQ channels through my program such as to make the program portable? I came across notes that mentioned DAQ global channel but I don't know how to use it.

Thank you in advance,
Sharmila
0 Kudos
Message 1 of 20
(5,366 Views)
I would suggest to start using DAQmx instead of the traditional NI-DAQ drivers. Soon, the NI-DAQ drivers will no longer be supported and you'll need to learn to use them anyway. DAQmx is a much better driver, and it's actually easier to setup and much more efficient. Of course, if you're not using LabVIEW 7.0 or 7.1, kindly ignore this message.

The attached VI uses DAQmx to programatically build a DAQmx task to scan 8 channels on a PCI-6025E every 250ms. It uses some DAQmx property nodes to query the system to see what devices are installed, so if you run it on a different system that has the wanted DAQ card setup as a different device number, this will catch it and build the correct task.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 20
(5,355 Views)
Thank you for the attachment. I am not very familiar with DAQmx. But taking your advice, I am replacing Traditional DAQ code with DAQmx.

THe DAQmx Create Virtual Channel allows for Digital Input or Digital Output channel creation. There is a DIO port which has some lines as input and some as output. Using AI Config I was able to specify the pattern. Do we have something similar in DAQmx?

Thanks,
Sharmila
0 Kudos
Message 3 of 20
(5,345 Views)
One of the great things about DAQmx is that there are only 4 basic VI's to learn to use. The Configure, Read, Write and Stop. The same Configure VI that was used to setup the analog input channels can be used to setup analog output, digital in/out and counter in/out.

The small menu on the bottom of the VI is actually a listing of all the different operations that this single polymorphic VI can do. Click on the down arrow and you'll see what I mean.

I've modified the example to read DIO lines 0-3 and write to lines 4-7 on Port 0. Again it programatically builds the channel list so it will always refer to the correct device. To create individual channels for a digital line, you first specify the device, then the port, then the line or lines. Example, to create a task for lines 4-7 on port 0, you would use "Dev1/port0/line4:7".

Notice that the "DAQmx Create Channel.vi" is the same one used in the analog input configuration, but with different polymorphic selections. Also note the "DAQmx Read.vi" is the same except for the selector.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 4 of 20
(5,337 Views)
Hi Sharmila and Ed-

Ed is correct- DAQmx will definitely be the way to go for all future apps. Its ease of use and short learning curve are far superior to Traditional DAQ.

Ed's tips on configuring channels are really well-done too- thanks for your input Ed!

Good luck with porting your applications to DAQmx Sharmila. Please let us know if you have any additional questions.

Regards,
Tom W
National Instruments
0 Kudos
Message 5 of 20
(5,328 Views)
Hi Tom and Ed,

Thank you for your support.

I have three cards that need to be configured: PCI 6025E, PCI-DIO-96 and PCI-6527. I have replicated the Build Task and Create Channels code for these three. My very first device, Dev1, is DIO-96. I get an error of -20048 from Create Channel.

I read about this error on NI website and the solution suggested was to create task for it in MAX and then use this task name. I want to automate this through the same program. How do I do it?

Thanks,
Sharmila
0 Kudos
Message 6 of 20
(5,318 Views)
Hi Sharmila-

I am unable to find the code you mentioned. Can you please verify the code or perhaps a quote of the actual error text so that I can troubleshoot the problem more effectively?

If you still have a link to the article you read on ni.com that would be helpful as well.

Thanks-
Tom W
National Instruments
0 Kudos
Message 7 of 20
(5,315 Views)
Hi Tom,

The code I am referring to is the one attached by Ed in one of his responses. It's called Build Task and Add Channel.vi. And I just did a search on DAQmx error codes and got to the page that described error codes in that range. If you don't find it, I will send it to you later.

thanks,
sharmila
0 Kudos
Message 8 of 20
(5,306 Views)
My guess would be you have the digital configuration incorrect. This can be a bit tricky as it's not always clear which choice to select. I know, I said this was easier, but there is a learning curve.

There's an input on the Digital Configure called "Line Gouping". In the last example I posted, this was set to create a separate channel for each line that was specified in the task. This lets you read or write a boolean array. If you are specifing an entire port/ports with no individual lines specified, you must change this to create a single channel for all lines. You must then also select the correct digital read or write operation from the polymorphic selector on the read/write VI.

The attached example configures 5 separate tasks on the three cards you mention. The two new tasks on the two DIO cards are showing a port selection setup.

I hope this gets you where you need to be.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 9 of 20
(5,300 Views)
Hi Ed,

Thanks for the very descriptive VI. But here's my simple problem. The create channel task out doesn't display any task name and the error code is non-zero. I have attached my test VI. Let me know if that works for you because it doesn't work for me. Device 1 on my machine is PCI-DIO-96.

Thanks,
Sharmila
0 Kudos
Message 10 of 20
(5,283 Views)