ni.com is currently experiencing unexpected issues.
Some services may be unavailable at this time.
06-20-2008 10:23 AM
06-23-2008 11:33 AM
HI COD3 MONK,
Welcome to the NI discussion forums. One suggestion I would have would be to put both digital output writes in the same task. One task can have multiple channels (or digital lines in this case). Doing so can simplify your code and prevent the need to wait for one task to complete before the next task can be created and executed.
I would take a look at the examples referenced in the following DevZone Article:
Using NI-DAQmx in Text Based Programming Environments
Examples located at:
C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNET\Examples\DAQmx or C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0
Folders named VB contain Visual Basic.NET examples, and folders named CS contain C# examples. One example that shows a multiple digital output VB .Net example is located at: (one of the two paths above)\Digital\Generate Values\WriteDigChan\vb
Another suggestion would be to use the synchronous function WriteSingleSampleSingleLine as opposed to the asynchronous write BeginWriteSingleSampleSingleLine. Is there a reason that you are using the asynchronous write? Combining the first and second suggestion you could use a function like WriteSingleSampleMultiLine to write to all of your digital lines in one task. This is the way it is done in the example program mentioned above.
Hope this helps,
Jared T.
06-30-2008 09:05 AM
06-30-2008 09:26 AM
Wow. Thanks for the suggestions. The second sounds a little too complicated 0.0.
I have been using the first method. Instead of writing asynchronously I am simply writing the task synchronously. I think I was having issues running a thread that was running the digiwrites asyncronously. Now im having my thread simply write the lines and it seems to be alot more reliable.