From the course: Learning LabVIEW

Controls - LabVIEW Tutorial

From the course: Learning LabVIEW

Start my 1-month free trial

Controls

- [Narrator] The input elements on a VI's front panel are called controls. Visually, they're designed to look like knobs, push buttons, dials, and sliders to simulate the controls you'd find on a physical instrument. Controls provide a graphical interface for users to interact with the VI and provide inputs to the block diagram and they also provide an interface for other VIs to programmatically pass input data. To show you some of the controls that are available I'll open a new VI from the LabVIEW welcome screen by clicking the create project button. As you can see, there are lots of templates to choose from, but for now I'll pick the option to create a blank VI, and click to finish. That brings up a new front panel and block diagram, I'll press ctrl+t to view both windows side by side. When looking at a completely blank VI, it can be a little tricky to tell the front panel and block diagram apart. By default, the front panel on the left is light gray with a grid pattern on it, whereas the block diagram on the right is just plain white. The front panel also has this connector pane icon in the top right corner, which the block diagram does not have, and we'll cover that later in more detail. Finally, you can always just look at the window's title bar to tell them apart. That may seem obvious, but I bring those differences up because I've gotten disoriented about whether I was working on the front panel or block diagram more times than I care to admit. To add a new control to this VI, I can right click anywhere on the front panel to bring up the controls pallette. LabVIEW includes an assortment of controls with different visual styles, including modern, NXG style, silver, system, and classic. Functionally, the controls from different styles all work the same, they just look different. Within each style, you'll find categories for different types of controls such as numerics, Booleans, strings, and so on. I'll go to the numeric pallette, which contains several controls and indicators for passing numeric data in and out of a VI, and this is where you'll find things like knobs, gauges, and sliders. To select a basic, simple numeric control, I'll click on this numeric icon and then click anywhere on the front panel to place it. This simple numeric input lets the user type a number into the box, or they can click the arrows on the side to increment or decrement its value. Notice that when I placed the control on my front panel it created a corresponding icon on the block diagram. The arrow terminal on the right side indicates that this is a control, so it serves as a source of data into the block diagram. Now, I'll place another control by going to the controls pallette, the numeric pallette, and I'll select a vertical slider. After placing a control, I can double click on the name above it and change it to anything I want. I'll call this set temperature, and when I make that change, the name of the corresponding icon on the block diagram changes too. I can also change the range of this slider by double clicking on the number 10 on top, and changing that to 100, if I think the slider needs to be a bit bigger on the screen, I can put my mouse over it, and then click and drag the tiny blue boxes that appear to resize it. There are multiple elements that make up this slider control, so it can be a bit tricky to select and resize the one you want. These are just a few of the many, many ways LabVIEW lets you customize the look and feel of controls. But, we don't have time to cover everything in this course. Now, let's add another type of control to this VI. I'll bring up the control pallette by right clicking and then go to the Booleans pallette. Unlike numeric values, Boolean elements can only have one of two possible values, they can either be true or false, and LabVIEW represents those Boolean controls as buttons and switches which can be toggled on or off. I'll select this basic push button and place it on my front panel. Now, I just placed a button control on my front panel, but let's say I decide I would rather have a toggle switch instead. I could delete that button and add a toggle switch, or I can right click on it, select replace, go to the Booleans pallette, and then choose a vertical toggle switch. Although the toggle switch gives my VI a different visual feel, as a Boolean, it functions similar to the button I replaced. I can also place a string control by going to the string pallette and this will allow the user to type in text. Now, as you place more and more controls on your front panel, it can be easy to lose track of their icons on the block diagram, so, if you ever need to find a control, just double click it on the front panel and the block diagram will flash to highlight its icon. There are many, many other types of controls, so I encourage you to take some time to explore all the options.

Contents