Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DI's clear DO's on same port using DAQmx DigWrite example

I'm trying add support to an NI PCI-6509 board to a VB.Net app.  I've used the following code from the DA!mx DigWrite example to set an output discrete:
 

' Create the DAQmx task.

DAQmxErrChk DAQmxCreateTask("", taskHandle)

' Add a digital output channel to the task.

DAQmxErrChk DAQmxCreateDOChan(taskHandle, txtChannelString.Text, "", DAQmx_Val_ChanForAllLines)

' Start the task running, and write to the digital lines.

DAQmxErrChk DAQmxStartTask(taskHandle)

DAQmxErrChk DAQmxWriteDigitalLines(taskHandle, 1, 1, 10#, DAQmx_Val_GroupByChannel, writeArray(0), sampsPerChanWritten, 0)

MsgBox "Samples per channel written = " & sampsPerChanWritten

' All done!

DAQmxErrChk DAQmxStopTask(taskHandle)

DAQmxErrChk DAQmxClearTask(taskHandle)

 

I modified the code to read an input discrete.  All works well unless I mix DIs and DOs on a single port.  For instance, if I set Port2/Line7, using the code above, and then try to read Port2/Line0, the discrete for Port2/Line7 is cleared when the read task starts.  This output remains set if the input is read from another port (e.g. Port1/Line0).

 

Can I not mix DIs and DOs on a single port?  Thanks for any help you can give me.

0 Kudos
Message 1 of 3
(3,121 Views)

Hello Mike,

You have already diagnosed the problem - the digital line direction on the PCI-6509 is only configurable by port, not by individual line, so you cannot mix inputs and outputs on the same port.

Let us know if you have additional questions.

Thanks!

Laura

Message 2 of 3
(3,106 Views)
Thanks, Laura.  Certainly not the answer I wanted to hear, but it will stop me from wasting time trying to get the card to do what it won't do.
0 Kudos
Message 3 of 3
(3,102 Views)