beautypg.com

B&B Electronics VFG3000 - Manual User Manual

Page 199

background image

W

RITING

A

CTIONS

C

HANGING

P

AGE

R

EVISION

1

P

AGE

183

W

RITING

A

CTIONS

While expressions are used to define values, actions are used to define what you want to
happen when a trigger or other event occurs. Since the vast majority of the actions in a
database will relate to key-presses, and since Fieldbus Gateway Manager provides a simple
method of defining commonly-used actions via the dialog box discussed in the User Interface
section, you will often be able to avoid writing actions “by hand”. Actions are needed,
though, if you want to use triggers, write programs, or use a key in User Defined mode.

C

HANGING

P

AGE

To create an action that changes the page shown on the Gateway’s display, use the syntax

GotoPage(Name)

, where

Name

is the name of the display page in question. The current page

will be removed, and the new page will be displayed in its place.

C

HANGING

N

UMERIC

V

ALUES

Fieldbus Gateway Manager provides several ways of changing data values.

S

IMPLE

A

SSIGNMENT

To create an action that assigns a new value to a tag or to a register in a communications
device, use the syntax

Data:=Value

, where

Data

is the data item to be changed, and

Value

is the value to be assigned. Note that

Value

need not just be a constant value, but can be any

valid expression of the correct type. Refer to the previous section for details of how to write
expressions. For example, code such as

[N7:0]:=Tank1+Tank2

can be used to add two tank

levels and store the total quantity directly in a PLC register.

C

OMPOUND

A

SSIGNMENT

To create an action that sets a data value equal to its current value combined with another
value by means of any of the operators defined in the previous section, use the syntax

Dataop=Value

,

where

Data

is the tag to be changed,

Value

is the value to be used by the

operator, and

op

is any of the available operators. For example, the code

Tag+=10

will

increase

Tag

by a value of 10, while

Tag*=10

will multiply the current value by 10.

I

NCREMENT AND

D

ECREMENT

To create an action that increases a data value by one, use the syntax

Data++

.

To create an

action that decreases a tag by one, use the syntax

Data--

. Note that the

++

or

--

operators

may be placed before or after the data value in question. In the former case, the value of the
expression represented by

++Data

is equal to the value of

Data

after it has been incremented.

In the latter case, the expression is equal to the value before it has changed.

C

HANGING

B

IT

V

ALUES

To change a bit within a tag, use the syntax

Data.Bit:=1

or

Data.Bit:=0

to set or clear the

bit as required, where

Data

is the tag in question and

Bit

is the zero-based bit number. Note

again that the value on the right-hand side of the

:=

operator can be an expression if desired,