LabView Tutorial Step-By-Step On How To Use ActiveX in Labview
LabView Tutorial Step-By-Step On How To Use ActiveX in Labview
1. Start Labview. Here we are using LabView 9 so you may notice different
icon, text and/or drop-down menu location when comparing to your version
of LabView. If your LabView is a much older version, please take a look at
the LabView 5 and LabView 6 examples
2. If possible, please open one of the LabView 9 Sample VI as reference.
LabView 9 examples include
1. test.vi, created from this lesson, up to step 36
2. test2.vi, based on test.vi, with added Waveform Chart beyond step 36
3. us9.vi, based on test.vi, but uses dial and list box for sample rate and
COM port selection
3. Follow New->Blank VI to create a new Front Panel
4. Right click on the grid on the Front panel
5. When the drop down menu shows up, click on the double down arrow at
the bottom of the menu, select .NET & ActiveX->ActiveX Container and place
one on the grid of the Front panel:
6. Right click inside the ActiveX container on Front panel, select Insert
ActiveX Object...., then Ultimaserial from the list. If you need to interface
to multiple Windaq Starter kits at the same time, you will need to create one
ActiveX container with Ultimaserial in it for each device
7. Repeat 3) to 5) to insert XChart
8. On the panel grid, follow Right-click->Buttons->Text Button to add a text
button
o Right click on the button
o Under the Appearance tab
Change the On text to Stop, Off text to Start.
Change Label to Start/Stop
Uncheck visible flag for the Label.
o Under Operation tab, change Button behavior to "Switch when
released"
9. On the panel grid, follow Right-click->Num Inds->Num Ind to add a
numeric display
10. Follow Right-click->Num Inds->Num Ind to add another numeric display
11. Follow Right-click->Num Ctrls->Num Ctrl to add a numeric input.
o Right click on it
Under Appearance table
Uncheck "Show Increment/decrement buttons".
Change Label text to Device
12. Follow Right-click->Num Ctrls->Num Ctrl to add another numeric input.
o Right click on it
Under Appearance table
Uncheck "Show Increment/decrement buttons".
Change Label text to "COM"
13. Follow Right-click->Num Ctrls->Num Ctrl to add another numeric input.
o Right click on it
Under Appearance table
Uncheck "Show Increment/decrement buttons"
Change Label text to "Sample Rate"
14. Save the vi as test.vi. Now the front panel of our vi should look like the
following:
15. From the menu bar, follow Window->Show Block Diagram to bring up the
test.vi Block Diagram, which is like the following
16. Right click on the workspace. When the drop down menu shows up, click
on the double down arrow at the bottom of the menu, select Programming-
>Structures->Stacked Sequences
17. Right click on the frame and select "Add Frame after"
18. Inside Frame 0, add "while loop" from RightClick->DoubleDownArrow-
>Programming->Structure->While Loop
19. Create a local variable for Start/Stop button, Change To Read, and connect
it to loop condition
20. Insert another stacked sequence to Frame 1 of the above stacked sequence
21. Add five frames to the new sequence, now the block diagram is like this
to
37. If you wish to plot the waveform to the Waveform Chart from Labview,
read on
38. Stop the program and switch back the Front Panel view
39. Resize the Panel so that we have room to add LabView's Waveform Chart
to it
40. Right click on the grid, follow Graph Indicators->Chart, and place a chart
on the Front Panel
41. Right click on the Waveform Chart and select properties
42. Select 2 for "Plots shown"
44. Switch to Block DIagram view of the project and wire the input of
Waveform Chart to the output of Variant To Data, like this
45. Switch back to Front Panel View, right click on Waveform Chart and
uncheck "Transpose Array"
46. Run it, and here is what you will see