Upload
eduuard-fraa-dedrick
View
217
Download
0
Embed Size (px)
Citation preview
7/27/2019 CLAD Add on for Workshop 3
1/21
Workshop3 of 7
Welcome!
7/27/2019 CLAD Add on for Workshop 3
2/21
Today's Topics
Review of Workshop 2
Diagram Disable Structure
Conditional Structure
Event Structure
7/27/2019 CLAD Add on for Workshop 3
3/21
Review Question 1
If I add a new element to an enum that is saved ina *.ctl file, how would the file need to be saved inorder to update all of instances
a) Custom control
b) Strict Type Definition
c) Type Definition
7/27/2019 CLAD Add on for Workshop 3
4/21
Review Question 1
If I add a new element to an enum that is saved ina *.ctl file, how would the file need to be saved inorder to update all of instances
a) Custom control
b) Strict Type Definition
c) Type Definition
7/27/2019 CLAD Add on for Workshop 3
5/21
Review Question 2
Which of the following always remain unique toeach instance?
a) Label
b) Default value
c) Size
d) Data type
e) Representation (numerics)f) Description
7/27/2019 CLAD Add on for Workshop 3
6/21
Review Question 2
Which of the following always remain unique toeach instance?
a) Label
b) Default value
c) Size
d) Data type
e) Representation (numerics)f) Description
7/27/2019 CLAD Add on for Workshop 3
7/21
Review Question 3
True or False?
A custom control can only be used for the projectwithin which it was created.
7/27/2019 CLAD Add on for Workshop 3
8/21
Review Question 3
True or False?
A custom control can only be used for the projectwithin which it was created.
FALSE
7/27/2019 CLAD Add on for Workshop 3
9/21
Diagram Disable Structure
Use to disable a section of code on the block diagram
Multiple subdiagrams possible maximum of one enabled
Disabled subdiagrams appear grayed out
Great tool for troubleshootingdont have to re-write code
7/27/2019 CLAD Add on for Workshop 3
10/21
Conditional Disable Structure
Use to define conditions that indicate which code on theblock diagram executes
Examples:
If running as an executable, then programmatically close
LabVIEW when VI finishes
If running on Windows, look for file here; if running on Mac OSXthen look here.
7/27/2019 CLAD Add on for Workshop 3
11/21
Events
Event An asynchronous notification thatsomething has occurred
Events originate from the user interface, external I/O, orother parts of the program
Example events:
11
Button click Value change
Mouse over Key press
7/27/2019 CLAD Add on for Workshop 3
12/21
Event Structure
Event Structure LabVIEWs programmatic toolfor handling events.
Therefore, execution of code can be dependent
on whether or not an event has occurred
12
Waits for an event to
occur indefinitely,
unless configured totimeout.
7/27/2019 CLAD Add on for Workshop 3
13/21
Parts of an Event Structure
13
Timeout Event Selector Label
Event Data Node Event Filter Node
Event Data NodeIdentifies the data
LabVIEW provides
when the event occurs;
similar to the Unbundle
By Name function
Event Filter Node
Identifies the subset of
data available in theEvent Data node that
the event case can
modify
7/27/2019 CLAD Add on for Workshop 3
14/21
Notify Events User action has already occurred LabVIEW has processed the eventAvailable only in the Event Data node
Filter Events User action has already occurred LabVIEW has NOT processed the eventAllows you to override default behavior for eventAvailable in the Event Filter node and Event Data node
Notify and Filter Events
7/27/2019 CLAD Add on for Workshop 3
15/21
Right-click theborder and selectEdit EventsHandled by ThisCase
To Configure an Event Structure
7/27/2019 CLAD Add on for Workshop 3
16/21
EventsEvent
Sources
Configured
Events
Configuring Event Structures
7/27/2019 CLAD Add on for Workshop 3
17/21
Notify Events (green arrow)
User action has already occurred
Filter Events (red arrow)User performed action but event is notprocessed. Allows you to customize eventhandling.
Notify and Filter Events in Config. Window
7/27/2019 CLAD Add on for Workshop 3
18/21
Normally used in aWhile Loop
Control/Indicator theevent configured for isoften placed insidethat event case
Event structurehandles exactly oneevent per iteration
Sleeps when noevents occur
Using Event Structures
7/27/2019 CLAD Add on for Workshop 3
19/21
Event Structures Tips
If no timeout is configured and an event neveroccurs stuck waiting indefinitely, must abortVI; therefore, wire the timeout terminal with a
value other than -1 (at least while developing) heavy code within the Event Structure causes
the front panel to lock up, often confusing theuser try to keep code in an event case to a
minimum
7/27/2019 CLAD Add on for Workshop 3
20/21
Demonstration:
Configuring an Event
7/27/2019 CLAD Add on for Workshop 3
21/21
Create a VI that uses events
Homework