LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use virtual channel name as input to DAQmx Write? LV8 and DAQmx

I've created a task for digital output that contains 8 named channels using the DAQmx Create Channel VI in Labview. Is it possible to use the channel name as an input to the DAQmx Write VI to reference the desired channel? I tried wiring a string with the channel name to the "task/channels in" input but I get a -200428 error that says the Value passed to the Task/Channels In control is invalid.
 
The help "name to assign" input for the DAQmx Create Channel VI says
   If you use this input to provide your own names for the virtual channels, you must use the names when you refer to these channels
   in other NI-DAQmx VIs and Property Nodes
 
OK, so how do you use the name assigned in other VIs?
 
George
0 Kudos
Message 1 of 6
(3,474 Views)

Create DAQmx global channel or a DAQmxtask in MAX.

It will automatically show up in the 'task/channels in' control of the DAQmx write ( select its type as digital>>single channel>>single sample>> Boolean) when u click on the selector of this control.

now write to this digital port.

hope this helps

regards

Dev

 

Message Edited by devchander on 03-08-2006 06:45 AM

Message Edited by devchander on 03-08-2006 06:49 AM

0 Kudos
Message 2 of 6
(3,468 Views)
I'd really like to do all the programming in LV and not have to setup anything in MAX (more work for distribution).  Also I'd like to be able to programatically select the channel (rather than having to click on the selector control).
0 Kudos
Message 3 of 6
(3,455 Views)
George,

I think that there may be some confusion here about the difference between local and global virtual channels.  First of all, please take a look at the following knowledge base:

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

As discussed in this KB, local global channels are created inside a task, and they only apply to that task.  In the help file for the DAQmx Write VI, the "task/channels in" description says "if you provide a list of virtual channels, NI-DAQmx creates a task automatically."  When you wire a string to this input, a new task is being created, and unless the channel name that you wire in is a global virtual channel (listed in MAX), you will get the error 200428 that you mentioned.  This is because that virtual channel that you are specifying is local to another task and is not associated with this new task. 

One solution to this issue is to use the DAQmx Save Global Channel VI to save your local virtual channel as a global virtual channel before calling DAQmx Write.  Once this is done, you can then wire the same string constant to the "task/channels in" input of DAQmx Write or other DAQmx VI's. 

The help text is still correct, but is only applicable in certain situations.  For example, if you create and name an analog input local virtual channel with DAQmx Create Channel, you could then use this channel name as the source input to a DAQmx Trigger VI configured for an analog edge start trigger.  You could also use that channel name as the input to the "ActiveChans" DAQmx Channel Property, which would enable you to modify the properties of that particular channel. 

Hopefully this information is helpful to you.
Message 4 of 6
(3,447 Views)
This sounds like good information.  Does this mean that a LV* user can program local virtual serial port channels, as well?  Currently, I have a .vi that reads a serial port on one channel from the NI USB-RS232 (4 port device) .  The .vi translates this data stream and sends it out on a second serial port of the NI-USB-RS232 device.  This second port is connected to the buile in COM port of a PC, since a separate, commercial off-the-shelf program must read from built-in COM 1 of the PC.  I have been looking at virtual serial port device drivers as a means to minimize this setup to one physicla com port (COM 1) and one, or more, virtual serial ports that are connected, virtually, as if they were connected by a null-modem cable.  I do not want to use the third party virtual serial port drivers to do this.  Can DAQMX support cirtual serial ports?
 
Thank you.
0 Kudos
Message 5 of 6
(3,440 Views)
The DAQmx driver is used specifically for our data acquisition devices and has nothing to do with serial ports.  Programming serial applications is done with the NI-VISA driver.  With VISA, you can assign aliases to your COM ports, but these are just names, and are not really comparable to DAQmx virtual channels, which store configuration information as well. 
0 Kudos
Message 6 of 6
(3,426 Views)