Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

preconfigure multiple lines prior to using device

I am using a USB-6008.  I am being converted from LabVIEW to C#.  Why?  Because I have to.
 
In LabVIEW I would normally preconfigue a set of DIO lines to either READ or WRITE and also setup the initial states.  For analog inputs, I would also setup the analog line parameters prior to actually using.  I would then pass the task id to the main program loop that would then read, write to DIO, read from analog input when told to again depending on how the lines were configured.
 
I am having a hard time seeing how to go about this in C#.
 
Every example is see uses a call to a procedure to redo alot of the some steps over and over again.
1.) Creating a task
2.) Creating the device Name
3.) Initializing the task
4.) Creating an object of the desired type to read or write from
5.) Performing the data transfer
 
If I want to write to line0, must do steps 1-5.  To write to line1, must do steps 1-5.  To write to line3, must do steps 1-5.
 
I would like to see examples of how to configure a system containing both digital IO and analog IO.  Then in the program, when a digital line needed to be set high (assuming this line was preconfigured as WRITE), it would happen with having to go through Steps 1-5 as every example shows.
 
Let me know if there are examples to do this and if not, I am looking for layman's terms to why it can't be done
 
 
 
0 Kudos
Message 1 of 2
(3,321 Views)
Hi Slzeb,

The best place to find examples DAQ applications is in C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNET\Examples\DAQmx or C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0.  These folders will be present if you have installed Visual Studio support with DAQmx.   If you have not, you can modify the installation to include VS support in the Add/Remove programs menu in the Windows control panel.

 

From these folders, go to Sychronization»Multi-Function to find a couple of examples of doing simultaneous IO tasks.  The folders name “cs” are the C# examples.  You can take the parts of various examples that you need.

Just as you would call a different instance of the DAQmx Read or Write VIs in LabVIEW, you must call different functions in C# to set up a single channel operation or a multichannel operation.  The help files for DAQmx are fully integrated into Visual Studio and explain how to set up tasks and channels.  Search the Visual Studio help for DAQmx Classes or DAQmx Task.   

You may also want to take a look at these articles:

Using NI-DAQmx in Text Based Programming Environments


http://zone.ni.com/devzone/cda/tut/p/id/5409

Learn 10 Functions in NI-DAQmx and Handle 80% of Your Data Acquisition Applications
http://zone.ni.com/devzone/cda/tut/p/id/2835

I hope this helps!

Regards,

Regards,
John Bongaarts
0 Kudos
Message 2 of 2
(3,303 Views)