If
you are using a later version of LabView, please follow the
step-by-step tutorial on how to use ActiveX in the latest LabView or take a
look at LabView 8
Sample
The following is a step-by-step tutorial on how to use ActiveX in
LabView
In this lesson, we will use Ultimaserial ActiveX to develop a
data acquisition application with DATAQ's Starter kit.
Run LabView (version 5 is used here) and open the sample
program. You should see the four basic elements on your screen: Panel Window, Diagram
Window, Tools Palette, Functions Palette if the Diagram Window has the focus
or Controls Palette if Panel Window has the focus. If you don't see the last two
elements, Follow Windows->Show Controls Palette and Windows->Show
Tools Palette to enable them. The following will serve as footnotes to the
sample program as you study it.
First you have to bring in the UltimaSerial ActiveX control
so that it can be used in the program
1) Right-click on the Panel
Window and insert an ActiveX Container, which is listed under OLE.
2) Right-click on the ActiveX Container on the Panel and follow ActiveX
Object ... to insert UltimaSerial ActiveX control (In the image below, UltimaSerial is
located at the lower left corner of the Panel)
To use UltimaSerial, you access the properties of
UltimaSerial ActiveX control
1) In the Diagram Window,
follow Funtions Palette->Application Control and select a Property Node
to place it in the Diagram.
2) Wire the node to the UltimaSerial icon, then right-click on the node to select the
appropriate property
In the following image, the
UltimaSerial icon is the little green rectangle below the toolbar of Diagram Window, and
we have six properties wired to it.
and to invoke the methods of UltimaSerial ActiveX control
1) From the Diagram Window,
follow Functions Palette->Application Control and select an Invoke Node
to place it to the Diagram.
2) Wire the node to the UltimaSerial icon, then right-click on the node to select the
appropriate method
In the following image, the
UltimaSerial icon is the little green rectangle below the toolbar of Diagram Window, and
we have one method (Start) wired to it.
Finally, you have to convert the variant returned by GetData
method of UltimaSerial ActiveX control to a data type that can be further processed in
LabView.
1) In the Diagram Window,
follow Functions Palette->Communications->ActiveX and select "To G
Data" to place it in the Diagram. This is what converts the variant to the
data type that can be used by Waveform Graph.
2) Also follow Functions Palette->Array and select Array Constant to
place it in the Diagram.
3) Wire the output of GetData to the variant pin of "To G Data"
and the Array Constant to the type pin of "To G Data" (See below)
Sample programs for LabView 6i
LabView 6i Sample Vi
Sample programs for
LabView 8
Last update: 03/14/22
Copyright: 2000-2005 www.UltimaSerial.com
|