Figure 4: Creating A User-Defined Function Block; Figure 5: Use Of User-Defined Function Block In Ladder Logic; Figure 6: Display Of Instance Data Structures - GE PACSystems RX7i Cpu Programmer's Reference Manual

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 2. Program Organization
Creating UDFB Instances
You create an instance of a UDFB by calling it in your logic and assigning an instance name in the
function properties.
In the following LD example, the first rung creates two instances of the UDFB, Motors. The instance
variables associated with the instances are motors.motor1 and motors.motor2. The second rung
uses the two instances of the internal variable temp in logic.

Figure 5: Use of User-Defined Function Block in Ladder Logic

Instance Data Structures
A variable with the format function_block_name.instance_name is
automatically created for each instance of a UDFB. The instance data
makes up a single composite variable that is of a structure type. The
example to the right shows the variable structures associated with two
instances of the UDFB named Motors. Each instance variable has
elements corresponding to parameters In1, Out1, and Y0, and internal
variables modelno, speed, and temp.
Instances are created as symbolic variables, never as mapped variables.
This ensures that instance data is only referenced by the instance name
and not by a memory address, which means that no aliases can be
created for the UDFB data elements. The indirect reference operator
cannot be used on an instance variable because indirect references are
not permitted on symbolic variables.
UDFBs and Scope
Unlike a parameterized subroutine, a UDFB has its own %L memory.
By default, internal variables of a UDFB have local scope, making them visible only to the logic inside
the UDFB. They cannot be read or written by any external logic or by the hardware configuration. An
internal variable can be made visible outside the UDFB by changing its scope to global. Logic outside
the UDFB can read but cannot write to internal variables whose scope is global.
Note: If you give internal variables global scope, your application will not conform to IEC
requirements.
12
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual

Figure 4: Creating a User-Defined Function Block

Figure 6: Display of
Instance Data
Structures
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents