Search This Blog

Thursday, August 28, 2025

LabView - Decision Making with Case Structure

The post talks about using the case structure in the labview VI programming.

Case structure using lab view

Operation:

  1. For ring constant = 0 i.e. case 0 x – y i.e. input 1- input 2= result
  2. For ring constant = 1 i.e. case 1 x + y i.e. input 1+ input 2= result
  3. For ring constant = 2 i.e. case 2 i.e. y-x i.e. input 1- input 1= result

Algorithm:

  1. Create a case structure on the block diagram
  2. Create two numeric control on the front panel
  3. Create a ring constant on the case structure
  4. Create three ring constants and three cases in the case structure
  5. Create a minus icon inside the case structure
  6. Connect the numeric controls to the icon then to the numeric indicator outside the case structure
  7. Create a one button dialog inside the case structure.
  8. Create a function on the dialog box and give the case (substraction)
  9. Run the program and view the result
  10. Change the ring constant to next one and change the case also. Replace add icon be minus icon.
  11. Create a new function in the dialog box and change the case (addition)
  12. Run the program and view result
  13. Create a new function (subtraction) in the dialog box, give the case, change ring constant
  14. Run the program and view the result

Lets do the following two things:

  1. Build a VI to find the square root of a given number .If the given number is a negative number display the message as “Error …The number is negative”
  2. Build a VI using case structure to switch between addition, subtraction, multiplication, division of two numbers.
Square Root of a given Number
Case Based Selection of Addition, Subtraction, Multiplication and Division

No comments:

Post a Comment