05-31-2006 02:07 PM
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.
06-01-2006 11:19 AM
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
06-01-2006 11:33 AM