Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxBaseCreateDIChan clarification

I am using DAQmxBaseCreateDIChan from C++ code on Macintosh OS X.

I read that the lineGrouping parameter must be set to DAQmxBase_Val_ChanForAllLines. If I were using NI-DAQmx on Windows, I would have a choice of DAQmxBase_Val_ChanForAllLines or DAQmxBase_Val_ChanPerLine.

1) Does this mean that using NI-DAQmx Base it is possible to use only whole ports, not individual lines?

2) When using NI-DAQmx on Windows, if I use DAQmxBase_Val_ChanPerLine, can I use DAQmxReadDigitalScalarU32 to read the state of lines on the task, which may be some random sub-set of the lines in the port?

3) I presume that whatever is true for reading digital ports would be true also for writing, using the appropriate write versions of the functions I have mentioned here.

Thanks to all of you who are so generous with your time!
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 1 of 3
(3,347 Views)
Hello John,

Below you will find the answers to your questions:

1) Does this mean that using NI-DAQmx Base it is possible to use only whole ports, not individual lines?

Yes, writing to the whole port is the only mode supported in DAQmx Base. I see this more or less the same though as being able to control each individual line, since you can write a one to any line you want to control, and the ones you don't want to control you can just write to them a zero. The same applies for the read: You can read the whole port, but actually just write data to the lines that you want to read, you can write zeros to all the other lines you don't want to use.


2) When using NI-DAQmx on Windows, if I use DAQmxBase_Val_ChanPerLine, can I use DAQmxReadDigitalScalarU32 to read the state of lines on the task, which may be some random sub-set of the lines in the port?

You can use the DAQmxReadDigitalScalarU32 ONLY if you are going to read one line, so the parameter for specifying your port should be DevX/portY/lineZ. If you want to read from more than one line, you would need to use DAQmxReadDigitalU32 to read the state of lines on the task.

3) I presume that whatever is true for reading digital ports would be true also for writing, using the appropriate write versions of the functions I have mentioned here.

Yes, its also true for writing.

Hope this helps,

Luis Navarro
National Instruments
0 Kudos
Message 2 of 3
(3,342 Views)
Thank you, Luis. You have been very helpful.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 3 of 3
(3,338 Views)