7
• Random Number function (in block diagram in Figure b To generate random numbers between 0 and 1, you will use the Random Number) function from the builtin LabVIEW library.
• Random Plot waveform chart (on front panel in Figure a You will use a Waveform Chart to display the random numbers being generated. In the block diagram in Figure b, notice that the Random Number function is wired to the Random Plot terminal. The Random Number function generates a number which then flows through the Random Plot terminal to the waveform chart on the front panel.
• ‘
While Loop’ structure (gray rectangle surrounding all nodes in Figure b Since the Random Number function only generates
one number for each run, you must place the Random Number function (and all the other icons) inside a While Loop structure to continuously generate random numbers. The While Loop executes all
subdiagrams within its boundaries until you wire
a TRUE or FALSE value to its conditional terminal (icon at the bottom right corner of the While Loop. Execution of
the While Loop can beset to Continue if True or
Stop if True. For this VI,
the condition is set to Stop if True. The icon at the bottom left corner of the While Loop is the
iteration terminal which contains the number of completed iterations of the While Loop.
• Stop button (on front panel in Figure a To allow the user to stop the continuous While Loop, you will add a Stop button on the front panel.
On the block diagram, note that there is a control terminal (labeled stop) corresponding to the Stop button and it is wired to the conditional terminal of the While Loop. When you click on the Stop button, a TRUE value is passed through the Stop button terminal to the conditional terminal of the While Loop. When the While Loop checks the value of the conditional terminal
at the end of the iteration, it will stop upon finding that the conditional terminal is TRUE since the execution condition is set to
Stop if True.
Share with your friends: