Chapter 4
Human Machine Interface
©
National Instruments Corporation
4-27
How Do You Implement Polled Programming in G?
You do not have to use a separate loop for each Tags or Alarms and Events
VI. This can be cumbersome to program for a large number of tag reads,
although using the HMI G Wizard makes it easy to build separate loops
quickly. The alternative is to poll the database for several tags at regularly
timed intervals. You usually need one While Loop in your diagram to poll
your front panel controls, so you can monitor what the operator is doing.
Using polling, you can combine monitoring of HMI controls with the
reading in of tag values and alarm states.
Figure 4-4 shows an example implementing a more complex user interface
that polls all the input tags as well as the front panel Start Batch button at
100 m/s intervals. When you leave the timeout input unwired, all Read
Tag VIs read the BridgeVIEW database immediately by default.
Note
In this case, you must explicitly program the loop wait time by using the Wait Until
Next ms Multiple VI. If you do not, the loop operates as often as possible, and
requires most of the CPU time.
This example also illustrates use of the Write Tag VIs. In this case, the
Write Tag (discrete) VI is called only when the front panel button is
pressed. In other cases, you might want to write the tag value at each
iteration. You also can use the Write Tag on Change VI to update the RTDB
only when the value of the front panel control changes. This can improve
your over all application performance.