0% found this document useful (0 votes)
54 views28 pages

Part 4

Here are the answers to the quiz questions: 1. d - The value passed into a node was converted to a different representation. 2. a - A While Loop must run at least one time. 3. d - The Connector Pane is only available on the block diagram. 4. a - Switch Until Released causes a Boolean control in the FALSE state to change to TRUE when you click it and stay TRUE until LabVIEW has read the value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views28 pages

Part 4

Here are the answers to the quiz questions: 1. d - The value passed into a node was converted to a different representation. 2. a - A While Loop must run at least one time. 3. d - The Connector Pane is only available on the block diagram. 4. a - Switch Until Released causes a Boolean control in the FALSE state to change to TRUE when you click it and stay TRUE until LabVIEW has read the value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

F.

Timing a VI
Reasons To Use Timing
Wait Functions and Express VIs
Timing a VI
Why do you need timing in a VI?
• To control the frequency at which a loop executes.
• To provide the processor with time to complete other tasks, such as
processing the user interface.
Wait Functions
A wait function inside a loop:
• Allows the VI to sleep for a set amount of time.
• Allows the processor to address other tasks during the
wait time.
• Uses the operating system millisecond clock.
Elapsed Time Express VI
• Determines how much time elapses after some point in
your VI.
• Keeps track of time while the VI continues to execute.
• Does not provide the processor with
time to complete other tasks.
Demo
1. Efek dari Wait (ms) dan Wait until Next ms Multiple
(ms)
2. Efek dari Elapsed Time Express VI
G. Data Feedback in Loops
Shift Registers
Initializing Shift Registers
Default for Unwired Values
Compound Shift Registers
Data Feedback in Loops
• When programming with loops, you often need to know
the values of data from previous iterations of the loop.
• Shift registers transfer values from one loop iteration to the
next.
Shift Registers
• Right-click the border and select Add Shift Register from
the shortcut menu.
• Right shift register stores data on completion of an
iteration.
• Left shift register provides stored data at beginning of the
next iteration.
Initializing Shift Registers
Run once VI finishes Run again

Block Diagram 1st run 2nd run


Initialized
Shift Output = 5 Output = 5
Register

Not
Initialized Output = 4 Output = 8
Shift
Register
Use Default if Unwired
Default values vary by data type:
Data Type Default Value

Numeric 0

Boolean FALSE

String Empty

Uninitialized shift registers use default values for first run.


Multiple Previous Iterations
• Stacked shift registers remember values from multiple
previous iterations and carry those values to the next
iterations.
• Right-click the left shift register and select Add Element
from the shortcut menu to stack a shift register.
Latihan 2 Aplikasi Kedap-Kedip LED
Buatlah sebuah aplikasi yang menerima inputan
frekuensi (Hz) dan mengeluarkan output berupa LED
yang kedap-kedip (ON/OFF) sesuai dengan frekuensi
yang diberikan.
Input: Output:
Frekuensi (Hz) LED (Boolean)
Tips:
- Gunakan While Loop
- Gunakan Shift Register
- Gunakan Wait (ms)
H. Plotting Data – Waveform Chart
Plotting Data – Waveform Chart
• Waveform
chart is a
special type
of numeric
indicator.
• Waveform
charts
display
single or
multiple
plots.
Waveform Chart Properties
•Extensive plot
customization lets
you:
• Show or hide
legends.
• Change color
and line styles.
• Change
interpolation
styles.
I. Case Structures
Parts of a Case Structure
Enum Case Structures
Error Case Structures
Input and Output Tunnels
Case Structures
• Have two or more subdiagrams or cases.
• Use an input value to determine which case to execute.
• Execute and display only one case at a time.
• Are similar to case statements or if...then...else
statements in text-based programming languages.
Case Structures
• Case Selector Label
• Contains the name of
the current case.
• Has decrement and Case Selector Label
increment arrows.
• Selector Terminal
• Lets you wire an input
value, or selector, to
determine which case
executes.

Selector Terminal
Case Structures
Selector terminal data
types:
• Boolean
• True case and False
Case
• Error Cluster
• Error Case and No Error
Case
• Integer, string, or enum
• Structure can have any
number of cases.
• Include a Default
diagram to avoid listing
every possible input
value.
Enum Case Structure
• Gives users a list of items from which to select
• The case selector displays a case for each item in the
enumerated type control
Shortcut Menu
Use the shortcut
menu of a Case
structure to:
• Customize the structure and
diagrams.
• Remove or replace the
structure.
• Add, duplicate, remove, or
rearrange cases.
• Specify the Default case.
• Switch cases.
Error Case Structure
Use Case structures inside VIs to execute the code if
there is no error and skip the code if there is an error.
Input and Output Tunnels
You can create multiple input and output tunnels.
• Inputs tunnels are available to all cases if needed.
• You must define each output tunnel for each case.
Demo
1. Membuat Case Structure
2. Menggunakan Case Structure dalam Aplikasi
3. Menambahkan, mengurangi dan menduplikasi case
4. Input dan Output Tunnel
Summary—Quiz
1. If an input to a function is marked with a red dot
(known as a coercion dot), what does the dot
indicate?
a) Data was transferred into a structure.
b) A For Loop was configured with a conditional terminal.
c) A For Loop iteration terminal is unwired.
d) The value passed into a node was converted to a different
representation.
Summary—Quiz
2. Which structure must run at least one time?
a) While Loop
b) For Loop
Summary—Quiz
3.Which is only available on the block diagram?
a) Control
b) Constant
c) Indicator
d) Connector Pane
Summary—Quiz
4. Which mechanical action causes a Boolean control in the FALSE state to
change to TRUE when you click it and stay TRUE until LabVIEW has read
the value?
a) Switch Until Released
b) Switch When Released
c) Latch Until Released
d) Latch When Released

You might also like