BEEE305P – Measurements and Instrumentation Laboratory
9. Programming using Case structures, Arrays and Clusters
[a] Addition or Subtraction of any two numbers using Case Structure
Aim:
To perform addition or subtraction of any two numbers using case structure in LabVIEW.
Software Required:
NI LabVIEW
Procedure:
• Open a new VI. Press Ctrl+T.
• Right-click in the front panel. Select Numeric>>Numeric Control and drop two
controls in the front panel.
• Right-click in the front panel. Select Numeric>>Numeric Indicator and drop it in the
front panel.
• Right-click in the front panel. Select Boolean>>Push Button and drop it in the front
panel.
• Add Case Structure in the block diagram.
• Now write the logic for cases “SUB” and “ADD” as shown in the figure.
• Run VI.
• Note: False: ADD; True: SUBTRACT
Block Diagram: “SUB” Case
VIT, Chennai
BEEE305P – Measurements and Instrumentation Laboratory
Block Diagram: “ADD” Case
Front Panel:
Result:
Thus, the VI to perform addition or subtraction of any two numbers using a case structure is
created.
VIT, Chennai
BEEE305P – Measurements and Instrumentation Laboratory
[b] Maximum and Minimum Element of an array
Aim:
To find the maximum and minimum element from an array in LabVIEW.
Software Required:
NI LabVIEW
Procedure: • Create
blank VI.
• Right click on the front panel →modern →array→ array matrix→ numeric control.
• Create four numeric indicators in the front panel for maximum variable, index,
minimum variable and index.
• Right click on block diagramArrayArray Max & Min.
• Using wiring operations, the required connections are given in the block diagram.
• Inputs are given in the front panel and the program is executed
Block Diagram:
VIT, Chennai
BEEE305P – Measurements and Instrumentation Laboratory
Front Panel:
Result:
Thus, the VI to find the maximum and minimum element from an array is created.
[c] Bundle and Unbundle Cluster
Aim:
To bundle and unbundle a cluster
Software Required:
NI LabVIEW
Procedure:
• Create a new VI.
• Create a cluster with numeric control, string and round LED.
• Create numeric indicator, Boolean indictor and string indicator.
• Using wiring operations required connections are given in the block diagram.
• Inputs are given in the front panel and the program is executed.
VIT, Chennai
BEEE305P – Measurements and Instrumentation Laboratory
Bundle Cluster
Block Diagram:
Front Panel:
Unbundle Cluster:
Block Diagram:
VIT, Chennai
BEEE305P – Measurements and Instrumentation Laboratory
Front Panel:
Result:
Thus, the VI to bundle and unbundle a cluster is created.
VIT, Chennai