05-21-2010 06:11 AM
Hi All,
I can't use DO port of the USB6211 device.. I'm using daqmx API functions with Delphi7.
First, I tried this:
DAQmxCreateTask('', @TaskDO);
DAQmxCreateDOChan(TaskDO, PChar('Dev1/port0'), '', DAQmx_Val_ChanForAllLines);
DAQmxWriteDigitalU8(TaskDO, 1, 1, 1, DAQmx_Val_GroupByChannel, $FF, @written, nil);
I got an error at DAQmxWriteDigitalU8: -200012 (= Digital Output Not Supported). (???)
Ok, I tried to turn off AutoStart option in DAQmxWriteDigitalU8 function and insert a "manual" start into the code:
DAQmxCreateTask('', @TaskDO);
DAQmxCreateDOChan(TaskDO, PChar('Dev1/port0'), '', DAQmx_Val_ChanForAllLines);
DAQmxStartTask(TaskDO);
DAQmxWriteDigitalU8(TaskDO, 1, 0, 1, DAQmx_Val_GroupByChannel, $FF, @written, nil);
DAQmxStopTask(TaskDO);
Now I got the same error at DAQmxStartTask: -200012 (Digital Output Not Supported, again). (?????)
I don't understand.. "Digital Output Not Supported"?! USB-6211 has 4 DO lines! What's the problem?
I simply want to switch on and off the DO lines from code..
- George Cs -
Solved! Go to Solution.
05-21-2010 08:04 AM
Well, finally I figured out.. 🙂
Here is the solution:
DAQmxCreateTask('', @TaskDO);
DAQmxCreateDOChan(TaskDO, PChar('Dev1/port1'), '', DAQmx_Val_ChanForAllLines);
DAQmxWriteDigitalU8(TaskDO, 1, @dummy, 1, DAQmx_Val_GroupByChannel, @bitmask, @written, nil);
The digital output lines are on port1! Parameter corrected.
And the interface part of DAQmxWriteDigitalU8 had to be changed (in nidaqmx.pas).
I don't know why, but AutoStart parameter (dummy) in DAQmxWriteDigitalU8 function is ignored: the function always starts task automatically, independently from the value of AutoStart. But this is not problem for me.
- George Cs -