Using the Euvis API Through LabVIEW
Euvis module products, such as AWG’s, DSM’s, and DAQ’s, can be controlled through companion API.
Users can develop their own applications with several CLR-based languages, such as C++, Java,
Visual Basic, etc, to control the modules via the API. These examples can be found on the individual
download pages of each product listed here.
Alternatively, the modules can also be controlled through widely used computation platform LabVIEW.
Requirements
LabVIEW does not support .NET 4.0 assemblies. To force it to load .NET 4.0 assemblies see the “Loading .NET 4.0 Assemblies in LabVIEW” on the National Instruments website. Follow the instructions given. If LabVIEW does not start once the configuration file is loaded, this may be due to unnecessary formatting text in the configuration file. Save the configuration file with the extension option as .txt so the there is zero formatting. Also, the Euvis API dll, Euvis_Module_V2p0.dll must be directly on the computer, not accessed from a network.
Procedure
In a new blank VI, place a Constructor Node on the block diagram. The block can be found under Connectivity --> .NET in the functions menu. This block will enable access to all the classes and their methods and objects.
The first class to assign is AWG_Group_API. To assign this, a menu will pop up,
Select .NET Constructor, when first placing the block or when you double click the block.
At the top, there is a drop down menu of all the assemblies that can be used in the VI. Click the
Browse button to search for Euvis API .dll file, Euvis_Module_V2p0.dll.
Once you choose the file and it has been loaded, there the Objects window will populate with all
the namespaces. Double click on MOL.AWG to choose AWG_Group_API.
Once the class has been chosen, the block will change to look like the image below.
By right clicking the block, the methods and properties in the class can be accessed under Create.
Now to get the serial number, initialize the AWG Module, and get the module name, several constructor
nodes, property node, and invoke nodes need to be created to access the methods and objects in Euvis API.
To do this, first create a flat sequence structure, which is found under Programming -->
Structures in the Functions menu. Create three frames to begin with by drawing a rectangle
to create the first frame. Then right click the frame and choose Add frame after. Add at least two
frames.
In the first frame, drag and place the AWG_Group_API node. Right click it and choose get_sn(Uint16 i) under Create --> Method for MOL.AWG.AWG_Group_API class. This creates an Invoke Node which invokes a method from a class. Wire new reference on the AWG_Group_API node to reference on get_sn node. Also, create a constant, 0, to wire to the blue input on the get_sn node. The block diagram should like the image below at this point.
Then create another constructor node, but choose the class AWG_API this time. Place this
node in the second frame. Also, create an invoke node for the method ini_sn(Int32_sn) in
the AWG_API class and place it in the second frame as well. Wire the references together
as before and blue output of get_sn to the blue input of ini_sn. The block diagram should
look like the following image.
To determine if a module is initialized, create an indicator. A green button on the front panel will light up
when the VI runs. Lastly, to get the module name, select the property module_name_string
under Create --> Property for MOL.AWG.AWG_Group_API class. Also, create an
indicator to see the name in the front panel when the VI runs. Place these blocks in the last frame and wire
the reference of module_name_string node to the reference out of AWG_API node.
The block diagram should look like the following image.
To make a more complete control use the same steps as above to create other constructor nodes, property nodes
and invoke nodes to use the other methods and objects in these two classes and other classes. Also, have each
node in a different frame or else LabVIEW will try to execute them simultaneously and it will not work. The
detailed examples can be found in the Appendices of the Application Note which can be downloaded below.
Tips
- To write constants as hexadecimals, right click on the constant and chose Display Format. A display menu will pop up. Choose Hexadecimal in the Type window and click OK.
- To write to a property node, right click the node and chose Change To Write. The output will move to be an input.
Downloads
A PDF version of the instructions can be downloaded below. Example codes mentioned in the instructions can also be downloaded as a ZIP file as well.
Name | Download | Size |
Using Euvis API Through LabVIEW Application Note | 3.13 MB | |
LabVIEW Example Codes | ZIP | 136 KB |