Case structure using lab view
Operation:
- For ring constant = 0 i.e. case 0 x – y i.e. input 1- input 2= result
- For ring constant = 1 i.e. case 1 x + y i.e. input 1+ input 2= result
- For ring constant = 2 i.e. case 2 i.e. y-x i.e. input 1- input 1= result
Algorithm:
- Create a case structure on the block diagram
- Create two numeric control on the front panel
- Create a ring constant on the case structure
- Create three ring constants and three cases in the case structure
- Create a minus icon inside the case structure
- Connect the numeric controls to the icon then to the numeric indicator outside the case structure
- Create a one button dialog inside the case structure.
- Create a function on the dialog box and give the case (substraction)
- Run the program and view the result
- Change the ring constant to next one and change the case also. Replace add icon be minus icon.
- Create a new function in the dialog box and change the case (addition)
- Run the program and view result
- Create a new function (subtraction) in the dialog box, give the case, change ring constant
- Run the program and view the result
Lets do the following two things:
- 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”
- 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