TechTip: Using Project Tags In a Macro On a Weintek HMI

In this TechTip we’re looking at using tags in a project and how they work in a macro. Address Tags are a great way to maintain control of elements you may wish to reassign later to an alternative address.

In our simple example, we have 2 tags set up in the Address Tag Library using local bits. They are called “Lamp” and “Lamp2” mapped to LB10 and LB100.

In our Macro we can pick Tags by ticking the “User-defined tag” box on the macro helper:

Macro from our example project is as follows… note the use of Tags “Lamp” and “Lamp2”:

macro_command main()

bool MyBitCalledLamp // MyBitCalledLamp is a boolean

GetData(MyBitCalledLamp, “Local HMI”, “Lamp”, 1) // GetData from the Tag “Lamp”
SetData(MyBitCalledLamp, “Local HMI”, “Lamp2”, 1) // SetData to Tag “Lamp2”

end macro_command

Example project available to download from here.