Course Manual

Setting up the System

  • If you are using the Emulator, load it by navigating to /root/Desktop/GettingStartedLabVIEW1-English-main/3) LabVIEW Instrument Emulator/builds/HandsOn/CTIPicoVISAEmulator/

  • Right-click in the window and select Open Terminal Here

cm 001.00 Loading CTIPicoVISAEmulator
  • Type in./CTIPicoVISAEmulator.exe

cm 002.00 TypeCTIPicoVISAEmulator.exe inCMD
  • The emulator will ask you to select a subnet.

cm 003.00 SelectThisSubnet
cm 004.00 HandsOnEmulatorFirstView
  • It will then sit waiting for a connection. “Connecting” will be displayed in status bar.

Lesson 1 – LabVIEW “Hello World” LED On/Off

Optional: Setting up the Hardware

Setting up the Pico Hardware

Wire your Pico Hardware to match the images below

pw 001.00 DigitalOutputsWiring
pw 002.00 DigitalOutputsWiring
Setting up the Raxda Hardware

Wire your Radxa Hardware to match the images below

rw 001.00 Power
rw 002.00 DigitalOutputsWiring
rw 003.00 DigitalOutputsWiring

Lesson 1 Instructions

The LabVIEW version of a “Hello World” program makes a piece of hardware do something basic, usually turning an LED on and off. In this case, you will also query the device so that it returns its “name.”

A block of code in LabVIEW is called a Virtual Instrument (VI). As such, a LabVIEW program has a *.vi extension and is comprised of two parts. The code resides in the Block Diagram and connects to the Front Panel (or User Interface.) The Front Panel displays data in indicators and receives data through inputs. (see the quick video in this post) An application is comprised of many, if not hundreds or thousands of VIs.

  1. Start LabVIEW

  2. Select a New VI.

    cm 005.00 SelectFile  NewVI
  3. For these lessons, you will want to see the Front Panel and the Block Diagram simultaneously. Arrange the components of the VI, the Block Diagram, and the Front Panel like this:

    cm 006.00 SetupScreen BlockDiagram FrontPanel Emulator
  4. Position the mouse over the Block Diagram and right-click. The Functions Palette opens.

    cm 007.00 NavigateToHandsOnPi2040DriverPalette
  5. Select and drop the following onto the Block Diagram: Initialize.vi, WriteDO.vi, and Close.vi.

    cm 008.00 DrangAndDrop Initialize WriteDO Close
The Run-arrow is broken (the run arrow appears in the top left corner), if you press it, it will list all the reasons why it`s broken.
  • LabVIEW will not let you run the source-code until these errors are sorted. Close the Error List and select all of the Vis. (Left-click drag on mouse).

cm 009.00 ErrorList 1
  • Press Ctrl+Space to bring up quick drop and Ctrl+W to wire the VIs together. Quick drop is an extremely useful productivity tool that ships with LabVIEW. It allows you to automate repetitive tasks with a few key combos.

cm 010.00 Ctrl+space Ctrl+W

If you press the Run arrow now you will notice that there are only 2 issues listed, good job!

  • Press Ctrl-H to bring up the context help window. Hover over Initialize.vi.

cm 011.00 Ctrl H HandsOnPi20240 Initialize
The VISA resource name is bold. This means that it needs to have an input.
  • Now, right-click on VISA Resource Name Initialize.vi and select create constant.

If you press the Run arrow now you will notice that there is only 1 issue left.

cm 012.00 Ctrl H HandsOnPi20240 WriteDO

This VI needs its Output and DO Value (True) wiring. So let’s create constants for them. Use the arrow on the right to select an output.

cm 013.00 ArrowPointingToConstantDropDown WriteDO
cm 014.00 WriteDO DO1(GPIO2)

It’s nice to have the constant label shown for booleans.

  • Right-click on the True Boolean Constant. This will bring up a drop down window, hover over Visible Items and select Label.

cm 015.00 RightClick VisibleItems Label
cm 016.00 WriteDO TrueConstant Labeled

We will also need to create a Constant for the VISA Reference Terminal. Like before, Right-click the VISA Resource Name tip strip and create a Constant

cm 017.00 RightClick Create Constant Initialize
cm 018.00 Initialize IOconstantWired

Constants are terminals on the block diagram that supply fixed data values to the diagram. We`ll discuss data types etc. later in the session.

  • Finally let’s wire in a couple of outputs.

  • Right-click on IDN for Initialize.vi and select Create Indicator. Then we need an error out, so Right-click at the bottom the Close.vi and select Create Indicator.

cm 019.00 RightClick Create Indicator Initialize
cm 022.00 Initialize IdentityOutputIndicatorWired
cm 020.00 RightClick Create Indicator Close
cm 021.00 Close ErrorOutput Wired
cm 023.00 Identity ErrorOut Indicators on FrontPanel

Notice how the Indicators appear on the Front Panel. We`ll discuss block-diagrams and front panels in a bit.

Now we have a running program!

However, you will notice the we`ll have an error.

cm 024.00 Identity ErrorOut Indicators Error on First Run
  • We can interrogate the error message to try and get a clue as to why it all went so wrong. Sometimes it can even be helpful.

cm 025.00 RightClick ExplainError

In this case it is!

cm 026.00 Error 1073807346 Explained
  • The VIs don`t know who they are talking to. To fix this, hardware users need to set the correct VISA reference from the VISA drop down box.. For Emulator users click the Copy button, as seen in the image below and paste the reference in, if you have hardware refresh and select the ASRL reference.

cm 027.00 CopyReferenceFromEmulatorIntoIOconstant
  • Now press run again.

Here we can see that no errors were apparent and Identity has a value.

cm 028.00 IDN ReturnData Displayed

But more importantly the LED on the hardware has turned on. image::cm_029.00_LED_Turns_ON.png[]

Lesson 2 – For Loops

This lesson is optional.

Optional: Setting up the Hardware

Setting up the Pico Hardware

Wire your Pico Hardware to match the images below

pw 001.00 DigitalOutputsWiring
pw 002.00 DigitalOutputsWiring
Setting up the Raxda Hardware

Wire your Radxa Hardware to match the images below

rw 001.00 Power
rw 002.00 DigitalOutputsWiring
rw 003.00 DigitalOutputsWiring

Lesson Instructions

A For Loop executes a sub-diagram a set number of times. In this case you will learn how to build a program that will blink the previous LED on and off 10 times each and then stop.

  • Make your workspace bigger to allow space for adding objects. Use Ctrl then drag to expand.

cm 030.00 ClickAndDrag toAddSpace
  • Alternatively select the objects you need to move with the selection tool and drag them where you want with the mouse, or using the arrows.

cm 031.00 SelectMoveAndDragWithMouse
Press Shift and an arrow key to move selected items quicker.
  • Now insert a For Loop, to do this Right-click anywhere on the block diagram to bring up the functions palette. Select Structures then For Loop.

cm 032.00 RightClick FunctionsPalette Structures ForLoop
  • You will only need to place the For Loop around the WriteDO SubVI (and the constants attached to it.)

cm 033.00 PlaceForLoopArroundWriteDO
  • Once the For Loop has been placed, you will see an N in the top left corner, this is the loop count (or how many times the loop will execute.)

  • Right-click on the left hand side of the Loop Count, and select Create a Constant. For this task you will need the Loop Count to be 20 (10 times on and 10 times off.)

cm 034.00 RightClick Create Constant TerminalN ForLoop
cm 035.00 ForLoopWired 20N

In order for the program to blink successfully it will need to know what the previous loop has executed, therefore you will need a Shift Register.

  • Right-click on the edge of the For Loop and select Add Shift Register. Wire the True Constant to the Shift Registers and the DO (Value) wire terminal.

cm 036.00 RightClick AddShiftRegister ForLoop
cm 037.00 ForLoopWiredIncludingShiftRegister
  • For a blinking LED you will need to invert the boolean value after every loop. To do this Right-click anywhere to bring up the functions palette. Hover over Boolean then select the Not Boolean. Wire this into the shift registers.

  • Double click the green wire connecting the True Constant to the SubVI and delete it. Move the True Constant outside the For Loop. Wire the Constant through the For Loop and into the Shift Registers.

cm 038.00 DoubleClick GreenWire Delete DragTrueConstant
cm 039.00 DragTrueConstantOutsideForLoop WireToShiftRegister
  • Remember to wire it back into the SubVI. 040.00_ForLoopWired-TrueFromShiftRegisterToWriteDO.png[]

If you were to run the program at this point the LED would light up, but would not blink.
  • For a blinking LED you will need to invert the boolean value after every loop. To do this Right-click anywhere to bring up the functions palette. Hover over Boolean then select the Not Boolean. Wire this into the shift registers.

cm 041.00 RightClick FunctionsPalette Boolean Not

The program will now work! However, it will execute very fast, and you will not be able to see the LED blinking. So you need to slow the Loop down.

  • Right-click inside the For Loop, hover over Timing. There will see many different timing options. For this you will use the Wait function. Select and place inside the Loop.

  • Create a constant by Right-clicking on the left side of the Wait function. The Wait function executes in milliseconds, therefore to slow down the Loop by 5 seconds, write 500.

cm 042.00 RightClick FunctionsPalette Timing Wait(ms)
cm 043.00 ForLoopWired Not
  • Now Run the program. You have successfully used a For Loop to blink the Digital Output.

Lesson 3 – While Loops

This lesson is optional.

Optional: Setting up the Hardware

Setting up the Pico Hardware

Wire your Pico Hardware to match the images below

pw 001.00 DigitalOutputsWiring
pw 002.00 DigitalOutputsWiring
Setting up the Raxda Hardware

Wire your Radxa Hardware to match the images below

rw 001.00 Power
rw 002.00 DigitalOutputsWiring
rw 003.00 DigitalOutputsWiring

Lesson Instructions

The While Loop executes the sub-diagram until a specific condition occurs. It will always execute at least one time.

In this case, you want the LED to continually blink on and off until a Stop button is pressed. You can create this using the previously built program with the For Loop.

  • Firstly, Right-click on the edge of the For Loop, and select Replace with While Loop

cm 044.00 RightClick ReplaceWithWhileLoop
  • Now the For Loop has been replaced, the Loop Count is not connected. This is not needed for a While Loop and can be deleted.

cm 045.00 20ConstantCanBeDeleted
  • To add a Stop boolean, switch to the front panel window and right click where you want to place the button. The Controls palette will appear, select Boolean and pick a button. The example uses a Push Button but any will work.

cm 046.00 RightClick ControlsPalette Boolean PushButton
  • Back on the Block Diagram move the new Control Boolean into the While Loop and wire it up to the Conditional Terminal in the bottom right corner. If the Button on the Front Panel is pressed when the program is running then the Loop will end and the blinking LED will stop.

image::cm_047.00_WhileLoopWired-BooleanSwitchWiredToStopTerminal.png

Exercise – Use DI to stop the loop

Optional: Setting up the Hardware

Setting up the Pico Hardware

Wire your Pico Hardware to match the images below

pw 006.00 DigitalInputsWiring
pw 007.00 DigitalInputsWiring
Setting up the Raxda Hardware

Wire your Radxa Hardware to match the images below

rw 001.00 Power
rw 006.00 DigitalInputsWiring
rw 007.00 DigitalInputsWiring

Hint: wiring diagram for DI

cm 048.00 HandsOnPi20240 ReadDI

Lesson 4 – Event Structure

Optional: Setting up the Hardware

Setting up the Pico Hardware

Wire your Pico Hardware to match the images below

pw 001.00 DigitalOutputsWiring
pw 002.00 DigitalOutputsWiring
Setting up the Raxda Hardware

Wire your Radxa Hardware to match the images below

rw 001.00 Power
rw 002.00 DigitalOutputsWiring
rw 003.00 DigitalOutputsWiring

Lesson Instructions

An Event Structure waits until a certain event occurs, then executes the appropriate case to handle that event. In this example, we want to press a buttons and the corresponding light to turn on.

  • First lets delete the while loop and its contents. Click on the While Loop and press the delete key. Do the same for the True constant. Then remove the broken wires with Ctrl+B.

cm 049.00 SelectWhileLoopToBeDeleted
cm 050.00 InitializeWiredToConstantIO
cm 051.00 Close ErrorOutput Wired2
  • Right-click to bring up the Functions Palette, hover over Structures then select Event Structure. Place the Event Structure on the Block Diagram.

cm 052.00 RightClick FunctionsPalette Structures EventStructure
  • Wire the Initialize VI and the Close VI through the Event Structure.

cm 053.00 EventStructureWiredPassThroughInitializeAndClose
  • Add a new Event Case by Right-clicking on the Selector Label, and select Add Event Case.

cm 054.00 RightClick AddEventCase
  • Add the WriteDO.vi by bringing up the Functions Palette, hover over Instrument I/O, Instr Drivers, HandsOnPi2040, and select `WriteDO.vi.

cm 055.00 RightClick FunctionsPalette InstrumentIO InstrDrivers HandsOnPi2040 WriteDO
  • Drag the sub VI inside the Event Structure and wire it up. Right-click the Output terminal and create a Constant.

cm 056.00 DragWriteDOInsideEvent RightClick CreateConstant
  • Change the Output from No DO – Error to DO1 by clicking the drop down arrow on the Output Constant.

cm 057.00 EventStructureWired ConstantDropDown DO1(GPIO2)
  • Next we need to add a button for the Digital Output. Go to the Front Panel, and Right-click anywhere to bring up the Controls Palette. Hover over Boolean, and select Push Button

cm 058.00 RightClick ControlsPalette Boolean PushButton2
  • Wire the new Boolean Control into the DO Value terminal.

cm 059.00 EventStructureWired BooleanControlTerminalWiredToWriteDO
  • Right-click on the Label Selector as we need to Edit Events Handled by This Case.

cm 060.00 RightClick EditEventsHandledByThisCase
  • This will bring up the Edit Events window. Select Boolean.

cm 061.00 EventStructure EditEventsWindow Select Boolean
  • This Event Case is now complete. We will need 3 more Event Cases, each one corresponding to a LED. The easiest way to do this is to Right-click the Label Selector, and select Duplicate Event Case.

cm 062.00 RightClick DuplicateEventCase
  • Select Boolean 2 on the Edit Events window.

cm 063.00 EventStructure EditEventsWindow Select Boolean2
  • It’s important to change the DO Constant when the case has been duplicated. (DO1 for Boolean, DO2 for Boolean 2, etc.) Duplicate this case 2 more times for DO3, and DO4.

cm 064.00 EventStructureWired ConstantDropDown DO2(GPIO3)
  • At this point your Front Panel may look a little messy, take some time to clean it up. This will make it easier to use when you have finished building the program.

cm 065.00 MessyFrontPanelWith4BooleansAndErrorOut
cm 066.00 OrganizedFrontPanelWith4BooleansAndErrorOut
You will be able to Run the program now, however, it will Stop after one Boolean has been selected. We can make this more efficient.
  • Back on the Block Diagram we will need to add a While Loop. Right click to bring up the Functions Palette, hover over Structures and select While Loop.

cm 067.00 RightClick FunctionsPalette Structures WhileLoop
  • Place the While Loop around the Event Structure.

cm 068.00 WhileLoopAroundEventStructure
  • Go to the Front Panel, so we can add a Stop button that we`ll connect to the Loop Condition. Right-click to bring up the Controls Palette, hover over Boolean, then select `Stop Button.

cm 069.00 RightClick ControlsPalette Boolean StopButton
  • We will also need to create a new Event Case for this Stop button. Right click on the Selector Label and select Add Event Case.

cm 070.00 RightClick AddEventCase ForStopButton
  • Place the Stop control inside the new case.

cm 071.00 EventStructureWired StopButtonInsideEventCase
  • Right-click the Selector Label and select Edit Events Handled by This Case

cm 072.00 RightClick EditEventsHandledByThisCase StopButton
  • When the Edit Events window pops up choose the stop option in the Event Sources table.

cm 073.00 EventStructure EditEventsWindow Select Stop
  • Our last step is to wire a True constant to the Loop condition. Right click to bring up the Functions Palette, hover over Boolean and select True Constant.

  • Place the Constant inside the Event Structure.

cm 074.00 RightClick FunctionsPalette Boolean TrueConstant
  • Wire the constant to the Loop Condition, like the image below.

cm 075.00 EventStructureWired TrueConstant ToStopTerminal
  • The program will now run successfully. You will be able to turn the LEDs on and off as many times as you want. You can use the Stop button to stop the execution of the program.

==

Lesson 5 – Numbers, Graphs and Charts

Optional: Setting up the Hardware

Setting up the Pico Hardware (Analog Input)

Wire your Pico Hardware to match the images below

pw 003.00 AnalogInputsWiring
pw 004.00 AnalogInputsWiring
pw 005.00 AnalogInputsWiring
Setting up the Raxda Hardware (Analog Input)

Wire your Radxa Hardware to match the images below

rw 004.00 AnalogInputsWiring
rw 005.00 AnalogInputsWiring

Lesson Instructions

Analog Input

Now you have made working programs using Digital Inputs and Outputs, it`s time to have a look at the Analog Inputs and Outputs.

For this lesson you will be focusing on the Analog Inputs.

cm 076.00 HandsOnEmulator HighlightingAnalogInputs
cm 077.00 PiCo AnalogInput
  • Like the lessons before, start with placing the Initialize.vi, and the Close.vi on a new Block Diagram.

  • Right-click to bring up the Functions Palette. Follow along with the image below and place the ReadAI.vi on the diagram.

cm 078.00 RightClick FunctionsPalette InstrumentIO InstrDrivers HandsOnPi2040 Initialize
  • You want to create a constant by Right-clicking on Analog Input on the left of the ReadAIs.vi, and selecting Create Constant.

cm 079.00 RightClick Create Constant ReadAI
  • Create an Indicator for the Analog value on the right side of the vi.

cm 080.00 RightClick Create Indicator ReadAI
cm 081.00 ReadAI Wired
  • Wire your program like the image below.

cm 082.00 Initialize ReadAI Close Wired
The program will successfully run at this point, however, it will execute too fast to move the Analog Sticks for continuous data.
  • To fix this issue, you can add a While Loop. Bring up the Functions Palette, then Structures, and select While Loop. Place this around the ReadAIs.vi, but leave space for other functions.

cm 083.00 RightClick FunctionsPalette Structures WhileLoop2
  • A While Loop will not work without adding a Loop Condition. In most cases this will simply be a Stop Boolean. Right-click on the Loop Condition and Create Control.

cm 083.00 RightClick FunctionsPalette Structures WhileLoop2
cm 084.00 FrontPanel StopButton ErrorOut
This will automatically add a Stop Boolean onto the Front Panel.
  • You can run the program now and when you turn the Analog Sticks the value will show.

cm 085.00 TurnAnalogSticksValueShows
If you are using physical Pico Bread Board and Analog Board you will notice the Value Indicator will flicker between numbers, this is normal and is simply extra noise from the equipment.
  • However, it is also possible to replace this with a Chart which will show the data continuously.

cm 086.00 RightClick Replace Modern Graph WaveformChart
  • Right-click on the Value Indicator, and hover over Replace. This will bring up the Control Palette. Select Graph and then a Waveform Chart.

cm 087.00 FrontPanel StopButton ErrorOut Chart

Analog Output (Write)

Optional: Setting up the Hardware

Setting up the Pico Hardware (Analog Output)

Wire your Pico Hardware to match the images below

pw 008.00 AnalogOutputsWiring
Setting up the Raxda Hardware (Analog Output)

Wire your Radxa Hardware to match the images below

rw 008.00 AnalogOutputsWiring
rw 009.00 AnalogOutputsWiring
  • Beginning with a Block Diagram with an Initialize.vi and a Close.vi. Right-click to bring up the Functions Palette. Follow along with the image below and add the WriteAO.vi onto the diagram.

cm 088.00 RightClick FunctionsPalette InstrumentIO InstrDrivers HandsOnPi2040 WriteAO
  • Wire up the 3 VIs.

  • Right-click on the Analog Output terminal and Create a Constant.

cm 089.00 RightClick Create Constant WriteAO
  • For this exercise the Analog Output will produce 2 different pieces of numerical data, therefore 2 constants will be grouped into a Cluster. So for now also create a Constant for PWM Settings

cm 090.00 WriteAO Wired
  • You will need to create a Bundle. Right-click on the Block Diagram to bring up the Functions palette, hover over Cluster, Class, & Variant, then select `Bundle By Name.

cm 091.00 RightClick FunctionsPalette ClusterClassAndVariant BundleByName
  • Delete the wire connected to the subVI, as it needs to be wired into the bundle you built before.

cm 092.00 SelectWireFromClusterToWriteAO ToBeDeleted
  • Wire the bundle and the like the image below.

cm 093.00 Initialize WriteAO Close withBundleDutyWired
  • Once wired up, you will notice that the bundle has the label Duty. Expand the Bundle down so the Frequency label is visible.

cm 094.00 DragAndExpandBundleByName Duty Frequency
  • Right-click at the edge of the bundle and create Constants for Duty and Frequency.

cm 095.00 RightClick Create Control DutyFrequency
  • The front panel should look like the image below. However, this needs some adjusting.

Using Numeric Control may be a little fiddly when the program runs, so in this case you will swap these out for Vertical Pointer Slides.
cm 096.00 RightClick Replace modern Numeric VerticalPointerSlide
  • Right-click on the Duty Control and hover over Replace. Select Numeric and then Vertical Pointer Slide. Do the same for the Frequency Control.

  • You will need to change the Scale of the Frequency slider. Right-click on the Slider, select Scale, Mapping, then Logarithmic.

cm 097.00 RightClick Scale Mapping Logarithmic
A logarithmic scale is useful when the data you are displaying is much less or much more than the rest of the data, or when the percentage differences between values are important.
  • The Duty slider can stay as a Linear scale.

cm 098.00 DutyScaleStaysLinear
cm 099.00 FrequencySlideScaleLogarithmic
  • Now you need to set the top and bottom points on the sliders. You will only need to change the highest point for Duty. Set it to 1.

  • For Frequency the lowest point should be 10 and the highest 500,000.

Now let’s head back to the Block Diagram and finish building the program.
  • Bring up the Functions Palette by Right-clicking on the Block Diagram, hover over Structures and select a For Loop. Place the For Loop around the WriteAO.vi.

cm 100.00 RightClick FunctionsPalette Structures ForLoop2
  • A For Loop needs a Loop Count. Choose a number that will allow you to time to use the dials and see how it executes on the Waveform Chart.

cm 101.00 ForLoopWired 500N
  • You will need to slow down the Program before running it. Bring up the Functions Palette, select Timing and place the Wait (ms) function inside the For Loop.

cm 102.00 RightClick FunctionsPalette Timing Wait(ms)
  • Right-click the left hand terminal on the Wait function and create a Constant. Type in 100 this will slow the program down enough for you to see the results.

cm 103.00 Wait(ms)Wiired100Constant
  • You can now run your program. Move the Vertical Pointer Slides up and down and you will be results will show on the Emulator.

cm 104.00 MovingSliders HandsOnEmulatorDisplaysMovement

Analog Output (Read)

If you want a more accurate representation for the Duty and Frequency sliders you can use the ReadAOs.vi.

Place the ReadAOs.vi inside the For Loop by repeat the same process you learnt at the beginning of the Analog Output (Write) lesson.

cm 105.00 RightClick FunctionsPalette InstrumentIO InstrDrivers HandsOnPi2040 ReadAO
  • Wire the subVI as show in the image below. Right-click on the AnalogOutput terminal and create a Constant, then create an Indicator for the AnOutValues.

cm 106.00 Intialize WriteAO ReadAO Close WithForLoop Wired
  • You can now run the program, and you will see the Values for Duty and Frequency on the Front Panel.

cm 107.00 Duty Frequency Outputs Updated on FrontPanel
If you are using the Simulator the values for both will appear on the Emulator.
cm 108.00 HandsOnEmulator Updating PWMDuty PWMFreq

General Concepts

VIs (Virtual Instruments)

Programs in LabVIEW are called VIs (Virtual Instruments). In other programming languages a VI is similar to a function or a subroutine. A VI includes a Front Panel and a Block Diagram, the VIs Icon and its Connector Pane.

Front Panel

The front panel window is the user interface for the VI. You create the window with controls and indicators, these are the interactive input and output terminals of the VI.

Block Diagram

The Block Diagram is where you will create the code for your program. The block diagram will implement graphical representations of functions to control the objects on the front panel. Objects on the front panel will appear as terminals on the block diagram.

Icons, Connector Panes, and SubVIs

The icon and connector pane allow you to use and view the VI in another VI. This is called a SubVI, to use a SubVI you must build a connector pane. Customising the Icon is recommended to help with reading and understanding the program. The Icon is displayed in the upper right corner of the VI, it is a graphical representation of the VI. The icon can be customised with text and images to help identify what the VI does. The connector pane is a set of terminals on the icon the corresponds to the controls and indicators of the VI.

cm 109.00 Icon
Figure 1. The default VI icon
cm 110.00 ConnectorPane
Figure 2. The default connector pane

Data Types

Each variable in a program must have a data type. The data types determines what type of value the variable will hold.

Numeric –

  • Integer (int) – whole numbers (e.g., -700, 0, 700)

  • Floating point (float) – numbers with fractions (decimals) (e.g., 700.0, 0.7)

Boolean – represents 2 states (e.g., true, or false, 1 or 0)

String – sequence of characters, digits, or symbols – always treated as text (e.g., hello)

Enumerated type – predefined unique values (can be text or numerical) (e.g., rock (0) jazz (1)

Character – a single letter, digit, punctuation mark, symbol, or blank space.

Array – stores multiple elements in a specific order. Note: black means no datatype selected. Drop another datatype into the array to make an array of that datatype.

cm 111.00 DataTypes
Right-click on a data type terminal and select View as Icon depending on your preference. The 2nd row shows the terminals as icons.

While Loops

While Loops allow portions of a program to execute repeatedly until a certain condition is met.

cm 112.00 WhileLoop
  1. Iteration Terminal – the iteration terminal provides the current loop iteration.

  2. Conditional Terminal – Evaluates a Boolean input value at the end of each loop iteration, if the conditional terminal is met then the loop stops.

For Loops

A For Loop executes a sub-diagram a certain number of times. This value is wired to the Count Terminal (N).

cm 113.00 ForLoop
  1. Iteration Loop – Indicates the number of completed iterations.

  2. Count Terminal – Specifies the number of times to execute the code inside the For Loop.

Event Structures

An Event Structure waits until an event occurs, then executes the appropriate case to handle that event.

cm 114.00 EventStructure
  1. The event selector label specifies which events cause the displayed case to execute.

  2. The Timeout terminals specifies the number of milliseconds to wait for an event before timing out.

  3. The Event Data Node identifies the data LabVIEW returns when an event occurs