General principles of g hmi programming, How do you implement event-driven programming in g, General principles of g hmi programming -25 – National Instruments BridgeVIEW User Manual

Page 129

Advertising
background image

Chapter 4

Human Machine Interface

© National Instruments Corporation

4-25

BridgeVIEW User Manual

General Principles of G HMI Programming

You can choose how to monitor and control tag values as well as operator
interface controls and indicators in your HMI. Normally, you use one or
more While Loops in a VI diagram with a single wait operation inside of
each loop. Each While Loop executes once after its wait operation
completes. The wait operation might be one of the Time and Dialog
functions such as the Wait Until Next ms Multiple function. This is a polled
technique in which your diagram controls loop execution.

Alternatively, the wait operation might be implemented using one of the
Tags VIs or Alarms and Events VIs with timeout wired to a non-zero value.
These are the types of diagrams created by the HMI G Wizard. This is an
event-driven technique, in which a tag or alarm event controls loop
execution. Either technique is appropriate, depending on your HMI needs.

You can wait on multiple events for which timing is not related to each
other in parallel on the same diagram, as long as you wait for each event in
a separate While Loop. This section covers the following topics:

Event-driven programming

Polled programming

Multiple loop applications

Real-time trends

Programmatic HMI indicator configuration

How Do You Implement Event-Driven Programming in G?

Event-driven programming means your block diagram waits for one or
more events to happen and, as each event occurs, the part of your program
waiting on that event is executed. In G, you can develop applications that
wait on different events and do operations in parallel by using multiple
While Loops in your diagram.

Figure 4-3 shows an example using event-driven programming to monitor
tag value and tag alarm state. One loop monitors the value of the

Mixer

tag

and another loop monitors alarm information for the

Mixer

tag. These two

loops run independently of each other. When the

Mixer

tag value changes,

or when

1.00

second has elapsed, the Read Tag VI returns and updates the

Mixer in Alarm

,

Mixer

,

value timestamp

, and

bad value

indicators. When the

alarm state

of the

Mixer

tag changes, or

5.00

seconds have elapsed, the Read Tag Alarm VI returns and updates the

Advertising