Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 36 ยท Getting Started

Your First VI: A Temperature Converter

Build, run and save a first LabVIEW VI step by step: a Celsius to Fahrenheit converter, then extend it with a loop, a graph and clean documentation.

Time to build something. This lesson walks through a complete first VI in the real editor, one click at a time, then extends it. Because LabVIEW cannot run on this site, there are no screenshots and no fabricated output; the JavaScript stand-ins let you check the arithmetic and logic that the VI performs.

The goal

Convert a temperature from degrees Celsius to degrees Fahrenheit using F = C x 1.8 + 32. The VI has one numeric control (Celsius) and one numeric indicator (Fahrenheit).

Build it step by step

  1. File > New VI. Two windows open. Press Ctrl+S right away and save it as Celsius to Fahrenheit.vi in a new folder. Saving early avoids a "Save As" surprise later.
  2. On the front panel, right-click and open Controls > Modern > Numeric. Place a Numeric Control. Type its label: Celsius and press Enter (or click outside).
  3. Place a Numeric Indicator from the same palette. Label it Fahrenheit.
  4. Press Ctrl+E to move to the block diagram. You will see two terminals, one for each object.
  5. Right-click the block diagram and open Programming > Numeric. Place Multiply, then Add.
  6. Right-click the second input of Multiply and choose Create > Constant. Type 1.8. Do the same for Add with 32.
  7. Wire Celsius to Multiply's first input. Wire Multiply's output to Add's first input. Wire Add's output to the Fahrenheit terminal.
  8. Back on the front panel, type 100 in Celsius and click Run. Fahrenheit should show 212.

If the Run arrow is broken, press Ctrl+L to open the Error List and read the message. The most common causes are a missing wire or two wires attached to the same input.

Check the math with a stand-in

You can predict what the VI shows. This JavaScript stand-in repeats the same two nodes in the same order, and tests well-known reference points.

JS Stand-in: the two nodes of the converter

Press Run (or Ctrl + Enter) to see the console output here.

No output.

A better way: the Formula Node

For longer equations, wiring many tiny nodes becomes clumsy. LabVIEW has a Formula Node (in Programming > Structures) where you type a text formula such as f = c * 1.8 + 32; and define input and output terminals on the node border. A MathScript node can hold more complex scripts. Use these sparingly: graphical nodes show data flow better, text nodes shine for dense math you copied from a paper.

Extend it: convert many values

Make the VI more useful by converting a range. Wrap the arithmetic in a For Loop (Programming > Structures): wire the number of iterations to N, use the loop counter i as the Celsius value, and leave a wire passing out of the loop edge. A loop tunnel with auto-indexing collects each result into an array. Show that array with an array indicator or a graph. You will study loops in while loops and for loops and arrays in arrays and auto-indexing.

This stand-in shows the same idea: a loop producing a list of conversions.

JS Stand-in: a For Loop with auto-indexing

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Make it professional

A VI that works is not finished. Do these small things now:

  • Labels: use clear names. Celsius beats Numeric.
  • Units: right-click a numeric control and choose Visible Items > Unit Label, then type degC. Units are just labels, though, not enforced.
  • Limits: Properties > Data Entry lets you set a minimum such as -273.15 and say what happens when a user types a smaller value. Absolute zero is a sensible lower bound.
  • Description: right-click a control and open Description and Tip. Fill in the tip strip. Users see it on hover.
  • Tidy wires: align terminals; avoid wires that run behind nodes.

See clean diagrams and documentation for a fuller checklist.

Saving and sharing

The file extension is .vi. A VI stores both panel and diagram. When you hand it to someone else, send the whole folder because VIs link to dependencies by name and path. If you keep a collection of related VIs, you will soon want a project file; see projects and libraries.

Never use the red Abort button as a normal way to stop a running VI. It halts without cleanup, so files stay open and hardware resources may stay reserved. Always give your VI a proper Stop button.

Common beginner mistakes

  • Placing a control when you needed an indicator, then wondering why you cannot write to it.
  • Wiring a constant into the wrong input of a function. Use Context Help to check each terminal.
  • Leaving Run Continuously on.
  • Forgetting to save, then hitting Abort.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the VI show for Celsius = 100?

    100 x 1.8 = 180, plus 32 gives 212.
  2. 2. Which key combination opens the Error List for a broken VI?

    Ctrl+L lists errors; Ctrl+B removes broken wires, which hides the cause.
  3. 3. Why is the Abort button a poor way to stop a program?

    Abort halts immediately; files and hardware may remain open.
  4. 4. What collects results from each loop iteration into an array?

    Auto-indexing builds an array as the loop runs.

Summary

  • A first VI needs a control, an indicator, nodes and wires; the converter uses Multiply and Add.
  • Press Ctrl+L to see why a Run arrow is broken.
  • Formula Nodes help with dense equations; graphical nodes show dataflow better.
  • A For Loop with an auto-indexing tunnel turns single conversions into an array.
  • Finish a VI with clear labels, limits, descriptions and a proper Stop button.

Next: Palettes, Tools and Shortcuts