workshop 05 review
DESCRIPTION
TRANSCRIPT
Workshop 05 Review
Today's Topics
Review of Workshop 05 State Machines Sequential Structures Parallel Processing
Documentation
Timing Functions
Review Question 1
If I add a new element to an enum that is saved in a *.ctl file, how would the file need to be saved in order to update all of instances
a) Custom control
b) Strict Type Definition
c) Type Definition
Review Question 1
If I add a new element to an enum that is saved in a *.ctl file, how would the file need to be saved in order to update all of instances
a) Custom control
b) Strict Type Definition
c) Type Definition
Review Question 2
True or False?
A sequence structure can be aborted in the middle of the sequence.
Review Question 2
True or False?
A sequence structure can be aborted in the middle of the sequence.
FALSE
• If you have a Wait Until Next Millisecond Multiple in a while loop with a 20 wired to it and the other code within the loop take 25ms to execute, how long will one iteration of the loop take?
a) 25 ms
b) 40 ms
c) 45 ms
d) unknown
7
Review Question 3
• If you have a Wait Until Next Millisecond Multiple in a while loop with a 20 wired to it and the other code within the loop take 25ms to execute, how long will one iteration of the loop take?
a) 25 ms
b) 40 ms
c) 45 ms
d) unknown
8
Review Question 3
Review Question 41. Which of the following is a state machine?
Review Question 41. Which of the following is a state machine?
Which block diagram objects compose a state machine?
a) While loop
b) Enum
c) Sequence structure
d) Case structure
e) Shift register
f) Numeric constants
11
Review Question 5
Which block diagram objects compose a state machine?
a) While loop
b) Enum (optional, although often used)
c) Sequence structure
d) Case structure
e) Shift register
f) Numeric constants
12
Review Question 5
• Free labels
• (standard) labels
• Descriptions
• Captions
• Tip Strips
13
Documentation
• Descriptions- appear in the
Context Help window when you
move the cursor over the object
• VIs: VI Properties» Description
• Controls, indicators, and constants:
Properties » Description
• Tip Strips
• Brief description of the object to
display when you move the cursor
over a front panel object while a VI
runs. (controls, indicators, and
constants)
14
Documentation: Description and Tip Strips
Documentation- Labels and Captions• Labels (including free labels) are available on the
front panel and block diagram
• Captions are only available on the front panel – use when you want to be more descriptive and…• don’t want to take as much space on the block diagram • programmatically use the label and don’t want to break
your VI
• To create a free label:• Double-click and begin typing• Place a free label form the Functions palette
• Be descriptive!For example,
• Does “Temp” mean temporary or temperature?• What are the units of “Temp”?
15
Use block diagram comments to:
• Describe algorithms
• Explain the data contents of wires
• LabVIEW 2010 and later: right-click on wire select Visible»Label
• LabVIEW 2009 and earlier: use a free label to label wires
• Using Unbundle/Bundle By Name creates self-documenting code
16
Documentation- Block Diagram
Demonstration: Adding a VI Description and Free Labels
Timing Functions
• Control or measure the frequency at which a loop executes
• Provide the processor with time to complete other tasks, such as processing the user interface
• Uses the operating system millisecond clock
Wait Function
• Waits the specified number of milliseconds.
• If 0 is wired to it, the current thread is forced to yield control of the CPU
• Uses the operating system millisecond clock
Wait Function- example cases
10 ms 20 ms 30 ms
Wait
Other code (running in parallel with Wait VI)
• Loop would go on to next iteration after 10 ms, because the only thing that happens in each iteration is wait 10 ms
• Loop would go to next iteration after 10 ms or more depending on amount of time the subVI takes.
• If subVI takes >10 ms, loop goes as soon as subVI is done
• If subVI takes <10 ms , loop goes at 10 ms mark.
Moment next loop iteration can begin
Wait Until Next Millisecond Multiple Function
• Waits until a multiple of the millisecond value wired in
• Provide the processor with time to complete other tasks, such as processing the user interface
• Uses the operating system millisecond clock
Wait Until Next Millisecond Multiple Function
10 ms 20 ms 30 ms
• Loop would go on to next iteration after 10 ms, because the only thing that happens in each iteration is wait 10 ms and 10ms is the first multiple of 10
• Loop would go to next iteration after 10 , 20, 30, or a greater multiple of 10 ms depending on amount of time the subVI takes.
• If subVI takes <10 ms , loop goes at 10 ms mark.
• If subVI takes 16 ms, then the loop goes at 20 ms.
• If subVI takes 22 ms, then the subVI goes at 30 ms.
Wait
Other code (subVI)
Comparison of Timing Functions
10 ms 20 ms 30 ms
Other code (running in
parallel with waits)
Moment next loop iteration can begin
Red represents times when Wait functions are NOT restricting
THANK YOU !!!