Run macros when tags or expressions change value – Rockwell Automation FactoryTalk View Machine Edition Users Guide User Manual
Page 567

30
•
Use macros
30-3
•
•
•
• •
Run macros when tags or expressions change value
You can use global connections to run macros when tags or expressions change value.
This means you can use the data source to trigger the macro to run.
FactoryTalk View allows you to create up to five macros for use with global connections.
The macros must be named Macro1, Macro2, Macro3, Macro4, and Macro5 in order to
work with global connections.
For more information about global connections, see Chapter 8.
Example: Use macros to reset tag values
This example shows you how to run a macro whenever the operator needs to reset
production information tags to known values.
The macro writes the desired values to the tags whenever the operator presses a
Momentary push button.
1. Create a memory tag called ResetProdData.
2. Create a Momentary push button with the caption “Reset Production Data.” Assign
the ResetProdData tag to the Value connection.
3. Create a macro called Macro1, with these tag assignments:
TotalProductionUnits=0
LineDownTime=0
TotalRejects=0
4. In the Global Connections editor, assign the ResetProdData tag to the Remote Macro1
connection.
When the operator presses the Reset Production Data button, the value of the
ResetProdData tag changes from 0 to 1. This tells FactoryTalk View to run Macro1, which
writes the specified values to the tags in the macro.