beautypg.com

Precedence – Rockwell Automation 9301 Series RSView32 Users Guide User Manual

Page 624

background image

A–4

RSView32 User’s Guide

Example 2: Changing the value of a tag and tag placeholders

In this example, Tag1’s initial value is zero. The value 4 is assigned to
the tag Tag1, which is then used in a macro. Type the following text in
a button’s press action:

Tag1 = 4

Sets the value of Tag1 to 4.

Display_Detail Tag1

Executes the Display_Detail macro,
using Tag1 as a parameter.

In the Display_Detail macro, type the following:

Display Screen$%1$

Displays a graphic display whose
name is Screen plus the value of Tag1
(for example, Screen 4).

RSView32 replaces the placeholder in the command with the tag’s
current string value. The graphic display Screen4 appears.

Tag placeholders are evaluated before commands are executed. You
can ensure Tag1 evaluates to 4 by embedding the tag placeholder in a
macro, not in the button. If you include the tag placeholder in the
button, the tag placeholder evaluates before the value of the tag is set
to 4. $Tag1$ will therefore evaluate to zero (the tag’s initial value),
not 4.

You don’t need to put braces around tag names when using
placeholders in commands.

Precedence

Commands take precedence over macros. For example, if you have a
macro called Activity the Activity command will run whenever you try
to run the Activity macro.