Presentation is loading. Please wait.

Presentation is loading. Please wait.

Doing some Boolean: On/Off

Similar presentations


Presentation on theme: "Doing some Boolean: On/Off"— Presentation transcript:

1 Doing some Boolean: On/Off
Examples of Boolean devices are switches LED’s Toggles, Sliders All of these items can be either controls (a switch) or an indicator (an output). Usually a switch would control and LED, but it can be arranged with LED’s controlling switches

2 Create a new VI from the File menu.
This should show both a Front Panel and Block Diagram

3 Add a Boolean Control on the Front Panel
Right-click anywhere in the Front Panel to bring up the Controls Palette. Hover on the Boolean Controls and left-click to select a Horizontal Toggle Switch. Left-click on the Front Panel to place the Toggle Switch in position.

4 You can resize the switch
You can resize the switch. This can usually be done for any Control or Indicator. Left-click on the switch to turn it on/off. This uses the Operating Tool from the Tool Menu. It should get automatically chosen for you.

5 Add a Boolean Indicator on the Front Panel
Right-click anywhere in the Front Panel to bring up the Controls Palette. Hover on the Boolean Controls and left-click to select a Square LED. Left-click on the Front Panel to place the LED on the Panel.

6 The Switch and the LED are now on the Front Panel
Right click on any of the objects change their attributes and properties.

7 A simple wiring of the Block Diagram completes the program.
It is a good idea to label the items with names that make sense to you.

8 Run this program and turn the LED on and off using the switch
You are now a Labview Programmer. Able to make lots of money for any company that wants to automate a test or measurement system.

9 Boolean Logic Booleans can often be used to control things in the program using logical conditions. We will do a simple “and” logic to demonstrate.

10 Add a Boolean Function on the Block Diagram
Right-click anywhere in the Block Diagram to bring up the Functions Palette. Hover on the Boolean and left-click to select an “And” logical. Left-click on the Block Diagram to place the And block in place.

11 The Block Diagram now has the “And” block.
An “And” goes True if both inputs are True. The two necessary controls could be added on the Front Panel and then wired. An easier method is to make them directly on the Block Diagram. Carefully place your curser on the top left Node of the And block. Right-click and create the Control for this Node. This will create the “x” Control Node. Repeat for the “y” Control Node.

12 Arrange the blocks neatly.
The corresponding controls show up on the Front Panel. Very Useful Technique This technique of right-click on the Node to create either a control or indicator makes programming much more efficient.

13 Right click to add the boolean indicator on the output of the And block.
Take the time to notice what the Nodes say when you hover over them. This describes how many of the blocks work.

14 The Front Panel comes out looking this way.
Run the program continuously and you should be able to figure out the logic of the And block.

15 You can right-click on any of the objects and replace them with ones that you like better.
Properties can be modified also to change the appearance or the operation of controls and indicators. Sometimes it can be difficult to tell what is on/off for certain types of these boolean devices.

16 Numeric comparisons have a Boolean output.
Numerical values can be compared in a variety of ways. Right-click on the Block Diagram and look at the Comparisons that can be made.

17 Place a pair of numerical controls on the Front Panel of your VI.
Go to the Block Diagram and place an Equals block in it. Wire the controls to it. Create the indicator by right-clicking on the correct Node of the block. Continuously run this vi and see that the LED goes on when the two values are equal.

18 Your finished project should look something like this
Your finished project should look something like this. One issue you might have is Getting the numbers to be equal because of the decimal points. You can change the Numbers to integer representations to make them easier to make equal. This is done Under the “Properties” menu and I did it with the Slider so that it can be equal to 7.

19 Labview Boolean Assignment
Make the basic LabView VI that corresponds to this tutorial. Add some other feature to your VI that demonstrates that you can do something with booleans. I suggest putting more than 1 boolean “and” or “or” block. Compare some numbers for larger or smaller. If you are in Geometry, you could make a LabView VI that will tell if three lengths of bar will go together to make a triangle.


Download ppt "Doing some Boolean: On/Off"

Similar presentations


Ads by Google