Setting Required, Recommended, and Optional Inputs and Outputs In the Context Help window, the labels of required terminals appear bold, recommended terminals appear as plain text, and optional terminals appear dimmed. When you create a new probe, the data type of the probe matches the data type of the wire you right-clicked. Figure 3-27 shows the elements of a multiplot waveform chart. The Explain Error dialog box contains information about the error. Use the Project Explorer window to modify the project. Data you enter into the front panel controls a and b in the previous front panel enter the block diagram through the control terminals. Figure 3-9 shows an example of these data pairs in the Properties dialog box for an enumerated control.
The most commonly used data types are numeric, Boolean value and string. Support Worldwide Technical Support and Product Information ni. You can specify the range and precision of fixed-point numbers. Using While Loops for Error Checking and Error HandlingYou can wire an error cluster to the conditional terminal of a While Loop or a For Loop with a conditional terminal to stop the iteration of the loop. Generally, this means that a required input is not wired, or a wire is broken. This font also emphasizes lines of code that are different from the other examples. Right-click a terminal and select Find control or Find indicator from the shortcut menu to locate the control or indicator on the front panel.
To change the representation type of a number, right-click the control, indicator, or constant, and select Representation, as shown in Figure 3-6. Custom Use the Create New Probe dialog box to create a probe based on an existing probe or to create a new probe. Integer Case Structure Figure 3-33 shows an integer Case structure. The iteration count for the While Loop always starts at zero. The terminal on the right side of the loop contains an up arrow and stores data on the completion of an iteration. The waveform graph accepts a 2D array of values, where each row of the array is a single plot.
In this case, the block diagram executes from left to right, not because the objects are placed in that order, but because the Subtract function cannot execute until the Add function finishes executing and passes the data to the Subtract function. If you wire an error cluster to the conditional terminal, the shortcut menu items Stop if True and Continue if True change to Stop on Error and Continue while Error. After five iterations of the For Loop, the shift register passes the final value, 10, to the indicator. When such errors occur, you want to ensure proper shutdown of your application. Alternate instructions are provided for completing the exercises without hardware. The iteration terminal is an output terminal that contains the number of completed iterations.
Graphical and CompiledWhile represented graphically, with icons and wires instead of with text, G code on the block diagram contains the same programming concepts found in most traditional languages. Click the Step Out button to finish executing the current node and pause. Removing Items from a ProjectYou can remove items from the Project Explorer window in the following ways: Right-click the item you want to remove and select Remove from Project from the shortcut menu. . Right-click a wire and select Custom Probe»Generic Probe from the shortcut menu to use the generic probe. To practice the concepts in this section, complete Exercise 1-3. The connector pane displays the default data types for this polymorphic function.
Arrays An array consists of elements and dimensions. The Error list window lists each error and describes the problem. The two common numeric objects are the numeric control and the numeric indicator, as shown in Figure 1-8. Tools Palette You can manually choose the tool you need by selecting it on the Tools palette. This includes mean, sum, standard deviation, and extreme values.
Undefined or Unexpected Data D. Integer Case Structure In Figure 3-33, Ring is a Text Ring control that associates an integer value with the text items add and subtract. Undefined or Unexpected DataUndefined data, which are NaN not a number or Inf infinity , invalidate all subsequent operations. For example, in Figure 1-29 the Wiring tool wires the Number of Measurements terminal to the count terminal of the For Loop. In addition the direction of the wires must be correct. A function has a pale yellow background on its icon.
Changing the Case View of a Case Structure If you enter a selector value that is not the same type as the object wired to the selector terminal, the value appears red. Wire the dynamic data type to an indicator that can best present the data. Refer to Lesson 5, Creating and Leveraging Data Structures, for more information about error clusters. You also can access this option from the Help menu. Which function executes first: Add or Subtract? For example, on numeric controls, the data range is not part of the data type. Build ArrayConcatenates multiple arrays or appends elements to an n-dimensional array. Feedback Nodes are another method for retaining information from a previous iteration.
If you use the Unbundle By Name function, you can have an arbitrary number of output terminals and access individual elements by name in any order. Without it, you might observe unexpected behavior but struggle to find the source of the problem. When the data type of a type definition changes, all instances of the type definition automatically update. Select the While Loop from the palette then use the cursor to drag a selection rectangle around the section of the block diagram you want to repeat. The Case structure executes the appropriate case subdiagram based on the current item in the enumerated type control. You can arrange items in a folder.