04-14-2010 08:05 AM
We are using the 6221 (PCI) Multifunction card and are using port 0 for digital output and port 1 for digital input. Each process has one Task and is read/written with DAQmxReadDigitalU8.
Now we want to use all 3 ports and divide them into 12Bits IN/12Bits OUT
Is it possible to assign the first 12 bits to a task and the last 12 bits to another task ?
What is the syntax for the Channels ? (e.g. "/port1/line4:7,/port2/line0:7") ???
How can i read 12 Bits ? Do I have to use DAQmxReadDigitalU16 ?
We are using C-API.
Any ideas or examples ?
Thanks in Advance !
04-14-2010 01:14 PM
LabJoe,
Thanks for posting on the NI Forums. I am guessing you are wanting to do this Digital Task statically, or software timed. Overall, you can set the direction of any digital line on the 6221 as either write or read. The card lets you configure this on a per channel basis, not per port. I was able to set up a similar program in LabVIEW, and what you will need to do is create two tasks, one for digital input and another for digital output. I had configured the line grouping for "one channel for all lines" so I could write and read U16 values. When I set up the channels for each task they looked like the following:
Input:
6221/port0/line0:7, 6221/port1/line0:3
Output:
6221/port1/line4:7, 6221/port2/line0:7
I would use the DAQmxReadDigitalU16 and DAQmxWriteDigitalU16 functions to read and write data as you need. As far as examples go, I would recommend looking at a couple of C examples that come with the DAQmx driver.
Writing: WriteDigChan.c
Reading: ReadDigChan.c
These can both be found from the Start Menu >> All Programs >> National Instruments >> NI-DAQ >> Text-Based Code Support >> ANSI C Examples >> Digital. If you use the functionality in both of those programs you should be able to write a program that performs the 12 bit read / 12 bit write. Hope this helps and let me know if you have any questions. Thanks!
04-15-2010 08:15 AM
Hello,
thanks for your answer. It worked.
Is there a syntax for the channel name, where the device is contained only once ?
This works : "6221/port0/line0:7, 6221/port1/line0:3" but device (6621) is used 2 times
e.g. 6221/port0/line0:7+/port1/line0:3 ???
or something like 6221/port0/line0:11
Thanks in Advance
04-15-2010 09:29 AM
LabJoe,
The syntax for the channels is set based on the hardware configuration of the device and cannot be changed. I have linked a KnowledgeBase Document that describes the Syntax a little more. Thanks!