workshop 05 review

24
Workshop 05 Review

Upload: migiwara

Post on 23-Jan-2015

116 views

Category:

Business


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Workshop 05 Review

Workshop 05 Review

Page 2: Workshop 05 Review

Today's Topics

Review of Workshop 05 State Machines Sequential Structures Parallel Processing

Documentation

Timing Functions

Page 3: Workshop 05 Review

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

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

Review Question 2

True or False?

A sequence structure can be aborted in the middle of the sequence.

Page 6: Workshop 05 Review

Review Question 2

True or False?

A sequence structure can be aborted in the middle of the sequence.

FALSE

Page 7: Workshop 05 Review

• 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

• 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

Review Question 41. Which of the following is a state machine?

Page 10: Workshop 05 Review

Review Question 41. Which of the following is a state machine?

Page 11: Workshop 05 Review

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

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

• Free labels

• (standard) labels

• Descriptions

• Captions

• Tip Strips

13

Documentation

Page 14: Workshop 05 Review

• 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

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

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

Demonstration: Adding a VI Description and Free Labels

Page 18: Workshop 05 Review

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

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

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

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

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

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

THANK YOU !!!