Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx write to port of 6025 using global virtual channel

Hello,
I have PCI 6025 with port A, B, C and DIO port.
with LabVIEW 8.0

In MAX, I create global virtual channel  Digital output Port1  as the physical port A, why they don't use the same name?
In MAX, create new global virtual channel, Digital output port 2, and port 3 as port B and port C.

Previously, with traditional LabVIEW, configure the port for output and write a hex number (0xFF).  that's simple.
I go into LabVIEW 8, using DAQmx, I can create a VI to write to port A,
1. using DAQmx create task, wire the global virtual channel to the create Task VI.
2. using DAQmx polymorphic digital 1D 1 channel N sample..
3. instead of hex 0xFF,  I make an array with 8 boolean elements.


Q1. Do I do this correctly?
Q2.  I would like to write to port A, port B and port C or port 1, 2 and 3.  Is there a way for me to increment the global virtual
channel so I have only one VI (WriteToPort), with input parameter: global virtual channel, and input parameter: portData?
 so I can pass in the parameters, and the VI will execute the write function.

Please give me examples
Thank you very much.

0 Kudos
Message 1 of 4
(2,759 Views)
Hello trout00,

A picture's worth a thousand words, so here's a screenshot of a program I wrote that does what you've described.  I've also attached my code for this.



I hope this helps,

Travis G.
Applications Engineering
National Instruments
www.ni.com/support

Message Edited by Travis G. on 06-08-2006 05:15 PM

Download All
0 Kudos
Message 2 of 4
(2,751 Views)
Thank you Travis,

I really need to keep me sharp on DAQmx.
Q1.  Does the port A of the PCI-6025E corresponds to port 0 or port 1.. ?
              or DIO bit 1 to 7 is port 0?

Q2. I already defined the global virtual channel in MAX, how do I use global virtual channel instead of
            Dev1/port0, Dev1/port1;Dev1/port2?
Q3. to keep things in modular style, how do Io create one write.VI ? and use a for loop to init one port at a time?
       and later on I re-use the same VI for writing to different ports and with different portDataValue.

Again, thank you for helping with DAQmx
0 Kudos
Message 3 of 4
(2,747 Views)
Hello trout00,

The terminal names for the digital ports in Traditional NI-DAQ (DIOA#, DIOB#, DIOC#,...) are named in NI-DAQmx P0.#, P1.#, P2.#.  So port A is now named port 0, port B is now named port 1, etc.  A list of the Terminal Name Equivalents between Traditional NI-DAQ and NI-DAQmx can be found in the E Series Help.

To use an NI-DAQmx global virtual channels you've defined in MAX, you'll need to add those virtual channels to an NI-DAQmx Task in MAX.  You can create a new NI-DAQmx Task by right-clicking on Data Neighborhood and selecting Create New, and selecting NI-DAQmx Task.  Select Digital > Port Ouput as the task type, and then when asked to add channels to the task, find your NI-DAQmx global virutal channels in the Virtual Tab, and add them to the task.  With a task created, you can now use this task from within LabVIEW in place of the DAQmx Create Channel VI I've shown in the above program.  Just place a DAQmx Task constant on your block diagram, select the task you've created in MAX in the drop down box, and wire it directly to the 'task in' terminal of the DAQmx Start VI, as shown in this screenshot:



If you want to read and write to ports individually, you'll have to create separate tasks and use separate a DAQmx Start, DAQmx Write, DAQmx Clear, etc. for each task.  You can just follow what I've shown you above and duplicate it for the different tasks you want to write to.

Also, here are some great resources for getting started with NI-DAQmx that would probably be helpful for you.

Learn 10 Functions in NI-DAQmx and Solve 80% of Data Acquisition Applications

Physical Channels, Virtual Channels, and Tasks in NI-DAQmx

More can be found at the Data Acquisition Support site at www.ni.com. 

I hope this helps,

Travis G.
Applications Engineering
National Instruments
www.ni.com/support

Message Edited by Travis G. on 06-09-2006 03:09 PM

Message Edited by Travis G. on 06-09-2006 03:09 PM

0 Kudos
Message 4 of 4
(2,738 Views)