Rockwell Automation FactoryTalk View Machine Edition Users Guide User Manual

Page 497

Advertising
background image

23

Use expressions

23-19

• •

Example: Use write expressions

In this example, the operator regulates the speed of a conveyor belt by entering a value in
feet or meters per second. When the operator enters the value in meters per second, the
value is converted to feet per second before being passed to the data source.

The operator first indicates whether the value is in feet or meters by pushing a Maintained
pushMaintained push button. The push button has one state corresponding to feet per
second, and the other state to meters per second.

Then the operator presses the Numeric Input Enable button and enters the value for the
conveyor speed in a numeric pop-up keypad. The ? character in the write expression is the
placeholder for the value the operator enters.

To set up the Maintained push button

1. In the Maintained Push Button Properties dialog box, in the States tab, set up these

states:

State 0—Value: 0, Caption: Feet/S

State 1—Value: 1, Caption: Meters/S

2. In the Connections tab, assign a digital tag called Feet_or_meters to the Value

connection (either an HMI tag or a data server tag).

To set up the Numeric Input Enable button

1. In the Numeric Input Enable Properties dialog box, in the Label tab, type the caption

“Enter conveyor speed”.

2. In the Connections tab, assign a tag called Conveyor_speed to the Value connection.

3. Assign this expression to the Optional Exp connection:

if Feet_or_meters == 0 then

?

else

? * 3.281

FactoryTalk View writes the result of the expression to the Conveyor_speed tag at the data
source.

Advertising