Activity 6-6: EquationsBuild a VI that uses the Formula Node to calculate the following equations: y1 = x3 + x2 + 5 y2 = (m * x) + b Use only one Formula Node for both equations. (Remember to put a semicolon [;] after each equation in the node.) Name the VI Equations.vi. Activity 6-7: CalculatorBuild a VI that functions like a calculator. The front panel should have digital controls to input two numbers, and a digital indicator to display the result of the operation (add, subtract, multiply, or divide) that the VI performs on the two numbers. Use a slide control to specify the operation to be performed (see Figure 6.82). Name the VI Calculator.vi. Figure 6.82. Calculator.vi front panel, which you will build during this activity
You will want to use Text Labels on the slide control, obtained from the pop-up menu of the slide, to specify the function (add, subtract, multiply, and divide). If you don't see this option in the pop-up menu, make sure you're popping up on the slide itself and not the scale. Slides with text labels behave very much like text ring controls. When you first select Text Labels, the slide will have two settings, max and min. You can use the Labeling tool to change this text. To add another text marker to the slide, pop up on the text display that appears next to your slide and select Add Item After or Add Item Before and then type in that marker's text. Note that wiring the output of a slide with text labels to the selector terminal of a Case Structure will not cause the cases to be typed as stringsthey will still be typed as numeric integers. Activity 6-8: Combination For/While Loop ChallengeUsing only a While Loop, build a combination For Loop/While Loop that stops either when it reaches "N" (specified inside a front panel control), or when a user pushes a stop button. Name the VI Combo For-While Loop.vi. Don't forget that a While Loop only executes while the conditional terminal (configured for Stop if True from its pop-up menu) reads a FALSE value. You might want to use the Or function (Programming>>Boolean subpalette of the Functions palette). Also, remember that while executing a loop, LabVIEW does not update indicators or read controls that are outside of the loop. Your stop button MUST be inside your loop if you want correct functionality. Activity 6-9: Dialog DisplayWrite a VI that reads the value of a front panel switch, and then pops up a dialog box indicating if the switch is on or off. Name the VI Dialog Display.vi. If you've developed the bad habit of using the continuous run button, now is the time to break it, or you will get yourself stuck in an endless loop! If you do get stuck, use the keyboard shortcut to stop your VI: <control-.> under Windows, <command-.> on a Macintosh, and <meta-.> under Linux. |