Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to a Physical Channel in CVi using DAQmx

I followed the directions in CVI to create a two task, one task creating a phyiscal channel for each output and the other task for creating a phisical channel for each input.  My question is how do I write/read physical channels in CVI. The only functions I see relate to writing/reading an arrays to a tasks, not a physical channel. 

0 Kudos
Message 1 of 7
(4,420 Views)

You might want to go to DAQmx Getting Started to get an idea of what DAQmx is.

 

Your task contains all of the phsyical channels you define with the DAQmx Create Channel or what you define in MAX. When you, for example, use a DAQmx Write with a specific task, all of those channels in the task are written to. When you perform a DAQmx Read with a specific task, all of the channels in the task are read. You can one or many channels in a task.

0 Kudos
Message 2 of 7
(4,411 Views)

Is there a way to use the DAQmx in a similar way as the Traditional DAQ's DIG_Out_Line and DIG_In_Line?  I'm guessing from what you are stating is that if I want to just write to one line, then I need a task for each line, is that correct? 

0 Kudos
Message 3 of 7
(4,398 Views)

Yes, using a separate DAQmxWriteDigitalx/WriteBinaryx is equivalent to using a separate Dig_Out_Line.

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

I think I'm missing something fundamental.  Attached is a sample project I started. I have two tasks, one for inputs the other for outputs.  When creating the tasks, I used one channel per line which created a name for each channel.

 

When using any of the DAQmxWriteDigitalx commands, you can only write an array to a task, no reference to a physical or named channel. When writing an array in this task, how do you know which element in the array corresponds to which channel?

 

 

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

For simple writes to a line, you should like at the example called WriteDigChan. This can be used for single or multi channels. If you have specified channels 2 and 3 in the DAQmxCreateDOChan, then when you pass the Boolean array to DAQmxWriteDigitalLines, element 0 is the value for channel 2 and element 1 is the value for channel 3. If you want to control a single channel, you would have an array with a single element.

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