Download - Workshop 05 Review
![Page 1: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/1.jpg)
Workshop 05 Review
![Page 2: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/2.jpg)
Today's Topics
Review of Workshop 05 State Machines Sequential Structures Parallel Processing
Documentation
Timing Functions
![Page 3: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/3.jpg)
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
![Page 4: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/4.jpg)
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
![Page 5: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/5.jpg)
Review Question 2
True or False?
A sequence structure can be aborted in the middle of the sequence.
![Page 6: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/6.jpg)
Review Question 2
True or False?
A sequence structure can be aborted in the middle of the sequence.
FALSE
![Page 7: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/7.jpg)
• 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
![Page 8: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/8.jpg)
• 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
![Page 9: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/9.jpg)
Review Question 41. Which of the following is a state machine?
![Page 10: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/10.jpg)
Review Question 41. Which of the following is a state machine?
![Page 11: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/11.jpg)
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
![Page 12: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/12.jpg)
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
![Page 13: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/13.jpg)
• Free labels
• (standard) labels
• Descriptions
• Captions
• Tip Strips
13
Documentation
![Page 14: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/14.jpg)
• 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
![Page 15: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/15.jpg)
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
![Page 16: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/16.jpg)
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
![Page 17: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/17.jpg)
Demonstration: Adding a VI Description and Free Labels
![Page 18: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/18.jpg)
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
![Page 19: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/19.jpg)
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
![Page 20: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/20.jpg)
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
![Page 21: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/21.jpg)
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
![Page 22: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/22.jpg)
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)
![Page 23: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/23.jpg)
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
![Page 24: Workshop 05 Review](https://reader033.vdocument.in/reader033/viewer/2022061222/54c159ab4a7959800b8b4575/html5/thumbnails/24.jpg)
THANK YOU !!!