Your objective is to build a simple VI that converts a Celsius temperature reading to Fahrenheit.
Front Panel
Open a new front panel by selecting File»New VI or by pressing <Ctrl-N>. If you closed all VIs, click the New VI button in the LabVIEW dialog box. Macintosh Press <Command-N>.
Select Window»Show Controls Palette to display the Controls palette. You also can access a temporary Controls palette by right-clicking an open area of the front panel. Macintosh <Command>-click to perform the same action as a right-click.
Select a thermometer from the Controls»Numeric palette and place it on the front panel.
Type deg C in the label text box and click the Enter button on the toolbar or click anywhere on the front panel to complete the new label. If the label is not highlighted, double-click the label to highlight the label and enter the text for the label.
Note If you click outside the text box without entering text, the label defaults to thermometer. To show the label again, right-click the control and select Visible Items»Label from the shortcut menu.
By default, a thermometer is an indicator because it displays a data value. In this VI, however, use the deg C thermometer as a control because it is the data source. Right-click the deg C thermometer and select Change to Control from the shortcut menu.
To make it easier to precisely enter a value into the deg C thermometer, make the Digital Display visible. To do this, right-click the thermometer and select Visible Items»Digital Display from the shortcut menu.
Now that you have a thermometer control for the Celsius temperature, you need an indicator to display the Fahrenheit value.
Select another thermometer from the Controls»Numeric palette and place it on the front panel.
Label this thermometer deg F as you did in step 3 and make the Digital Display visible as you did in step 5.
Because this thermometer will display temperatures in degrees Fahrenheit, change the scale of the thermometer so it can display readings higher than 100 degrees.
To change the scale of the deg F thermometer, double-click the topmost value of the scale and type 212, which is the Fahrenheit equivalent of 100 degrees Celsius, the highest visible value on the deg C thermometer.
Press the <Enter> key. Macintosh and UNIX Press the <Return> key.
(Optional) Use the Positioning tool to rearrange or resize objects. Move the cursor over the center of an object to select the Positioning tool.
To move an object, click the object and release the mouse button to select the object. A moving dashed outline called a marquee highlights the object. Drag the object to move it.
To resize an object, move the cursor over a corner of the object to display resizing handles . Move the Positioning tool over a resizing handle to change the tool to the resizing cursor. Use the resizing cursor to drag the resizing handles until the dashed border outlines the size you want, and release the mouse button.
Your front panel should look similar to the following image.
Block Diagram
Open the block diagram by selecting Window»Show Diagram, or by clicking the block diagram window behind the front panel window. You also can press <Ctrl-e> to switch between the front panel and block diagram windows. Macintosh Press <Command-e>.
Notice the objects on the block diagram. These objects are terminals that correspond to the thermometer control and indicator you placed on the front panel.
To convert a Celsius temperature value to Fahrenheit, multiply the Celsius value by 1.8 and add 32. Use the functions on the Functions»Numeric palette to build a block diagram that does this.
Select Window»Show Functions Palette to show the Functions palette. You also can access a temporary Functions palette by right-clicking an open area of the block diagram.
Select a Multiply function from the Functions»Numeric palette and drag it to the block diagram. Before you click the mouse button to drop the Multiply function on the block diagram, drag the function just to the right of the deg C terminal.
Notice when you hold the function close to the terminal, LabVIEW automatically draws a wire to one of the terminals on the Multiply function. When LabVIEW draws a wire between the function and the deg C terminal, click the mouse button to place the function on the block diagram. Notice the deg C terminal is wired to the Multiply function.
(Optional) If you placed the Multiply function without a wire connection to the deg C terminal, wire them together by completing the following steps.
Move the cursor over the black arrow on the right side of the deg C terminal. The terminal blinks, and LabVIEW selects the Wiring tool.
Click the deg C terminal to tack a wire to the terminal. You do not need to hold down the mouse button.
Move the cursor to a terminal on the Multiply function until the terminal blinks.
Click to tack down the wire and wire the two terminals together.
You need to multiply the deg C value by 1.8. Right-click the unwired input terminal on the Multiply function and select Create»Constant. LabVIEW creates a numeric constant value and wires it to the input terminal, with the numeric value highlighted for you to enter a value. Type 1.8 and click the Enter button, or click anywhere on the block diagram.
You need to add 32 to complete the calculation. Select an Add function from the Functions»Numeric palette and drag it to the block diagram. Before you click the mouse to place the Add function on the block diagram, drag the function just to the right of the output terminal of the Multiply function.
When a wire that connects the output terminal of the Multiply function and one of the input terminals of the Add function appears, click the mouse button to place the function on the block diagram. LabVIEW automatically wires the two functions together.
If the functions are not wired together, use the Wiring tool as described in step 4.
Right-click the unwired input terminal of the Add function and select Create»Constant, as you did in step 4. Type 32 and click the Enter button or click anywhere on the block diagram.
Now that you've multiplied the deg C value by 1.8 and added 32, you need to pass the value to the deg F terminal. Wire the output terminal of the Add function to the deg F terminal, as described in step 4.
Your block diagram is now complete, and should look similar to the following image.
Select File»Save and save the VI as Convert C to F.vi in the labview\activity directory.
Running the VI
On the front panel, double-click the digital display of the deg C thermometer and enter 37, which is normal body temperature in Celsius.
Run the VI by clicking on the Run button. Notice that LabVIEW converts the Celsius temperature to 98.6 degrees Fahrenheit and displays it on the deg F thermometer and its digital display. Enter other values in the deg C thermometer and run the VI.
Close the VI by selecting File»Close to close the VI.