Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing mulltiple ports simultaneously on PCI6220

I need to write out three 8-bit values, one to ports 0, 1 an 2 on a PCI6220. Is it OK to do the following?

 

DAQmxCreateDOChan(digTaskHandle, "Dev1/port0:2", "", DAQmx_Val_ChanForAllLines) DWORD dwVal = outBits[0] + ((DWORD)outBits[1] << 8) + ((DWORD)outBits[2] << 16); status = DAQmxWriteDigitalU32(digTaskHandle, 1, TRUE, 0.1, DAQmx_Val_GroupByChannel, &dwVal, &lWritten, NULL);

 

 

The docs imply that this will work but I may be reading it wrong.

0 Kudos
Message 1 of 4
(3,494 Views)

Hi Software Monkey,

 

Looking at your code, its not a way I have seen it done before but there are different ways to write code that does the same thing. I haven't got any hardware at the moment to test whether or not the code will work, have you tried compiling and running it? What program are you coding in? Labwindows/CVI has a feature where it will create DAQmx task for you and produce the code for it. Also what documents are you referring to?

 

Kind Regards,

Jas.W 

Jason W.
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 4
(3,463 Views)

Thanks for the reply. The code is written in C/C++ and the documentation I refer to is the NI-DAQmx C Reference Help.

 

 

It compiles OK but the hardware is at the customer's site so I would like to know if it is likely to work before I send it. 

 

Thanks

 

Tony

0 Kudos
Message 3 of 4
(3,461 Views)

Hi Software Monkey,

 

I've had a look through the documentation that you used and as far as I can see everything seems ok. It's hard to tell if it'll work without testing it on some hardware, but those commands seem correct.

 

If you have any other questions then please get in touch with us and we will be happy to help.

 

Kind Regards,

Jas.W 

Jason W.
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 4
(3,437 Views)