Topic: P341

User Defined Instruction

Mnemonic (Keyboard Shortcut) = UDI

Purpose

UDI functions are similar to function blocks in other programming environments; allowing users to define custom instructions tailored to their specific automation needs. These instructions help streamline programming by encapsulating commonly used logic into reusable, self-contained modules.

Instruction Parameters

Parameter

Parameter Type

Requirements

Description

Enable

Ladder Input

Must Have

Level-driven.  When Enable is ON, the instruction will operate every scan.  When Enable is OFF, the instruction is not solved and its Outputs are not updated.

UDI Definition

Dropdown Selection

Must Have

A UDI definition must be created in the UDI Management panel for this instruction. Once UDI definitions have been created, they can be selected in this field.

Name

Assigned from UDI definition editor window

Must Have

Allows the user to give a unique name (maximum 32 characters) to each UDI instruction instance for easier reference. *See Note 1 below

Parameters

 

Parameter Name

Assigned from UDI definition editor window

Dependent on UDI configuration

Displays the parameter name (defined in the UDI Definition Editor panel).

Type

Assigned from UDI definition editor window

Dependent on UDI configuration

Indicates the parameter data type (defined in the UDI Definition Editor panel).

Columns

Assigned from UDI definition editor window

Dependent on UDI configuration

Indicates the number of columns defined for an array parameter (defined in the UDI Definition Editor panel).

Num Chars

Assigned from UDI definition editor window

Dependent on UDI configuration

Indicates the number of characters defined for string parameters (defined in the UDI Definition Editor panel).

Default Input Value

Assigned from UDI definition editor window

Dependent on UDI configuration

Indicates the default beginning value (defined in the UDI Definition Editor panel) of a parameter when the UDI is executed, if it does not have a tag assignment. This only applies to parameters with Local, In or In/Out scope. *See Note 2 below.

Scope

Assigned from UDI definition editor window

Dependent on UDI configuration

Indicates how the parameter is used (defined in the UDI Definition Editor panel). Possiblescope selections are In, Out, In/Out, and Local.

Assignment Required

Assigned from UDI definition editor window

Dependent on UDI configuration

Indicates whether a Tag or value must be assigned to the parameter (defined in the UDI Definition Editor panel).

Comment

Assigned from UDI definition editor window

Dependent on UDI configuration

Use this field to add Comments associated with the parameter.

Tag

User Selectable

Must Have/Optional

This field allows the user to assign Tags or static values for the UDI parameters. If a parameter requires assignment, then a Tag or static value must be entered in this field.

Use Structure

Selectable Option

Optional

Enables the use of Structure for elements of the chosen UDI definition. Select from dropdown list of available structure names or enter name to create a new structure.

Devices

 

Name

Assigned from UDI definition editor window

Dependent on UDI definition

Indicates the name of the device (defined in the UDI Definition Editor Window).

Device

Assigned from UDI definition editor window

Dependent on UDI definition

Indicates the device definition assigned (defined in the UDI Definition Editor Window).

Device Type

Assigned from UDI definition editor window

Dependent on UDI definition

Indicates the specific type of device assigned (defined in the UDI Definition Editor Window). Not all devices will have a Device Type defined.

Configured Device

User Selectable

Dependent on UDI definition

This field allows the user to choose from the list of available devices that have been defined in the project Hardware Configuration that matches the UDI device..

Note 1: Can contain only a-z, A-Z, 0-9, hyphens, underscores, and spaces.

Note 2: Default value is only available if not marked as assignment required.

Accessing UDI Instruction

The User Defined Instruction (UDI) is located on the Instruction Panel under the Program Control section.


Instruction Configuration

When User Defined Instruction is selected the window shown below opens.

Parameter Configuration Table

File Read Instruction

 

(UDI)

Notes

* or or These icons indicate to use 1D and/or 2D Array data types as indicated in Data Type column.

UDI Definition

                   

Before using this instruction, the user needs to create a UDI definition in the UDI Management panel. After that, select a UDI definition in this field.

Name

                   

Give a unique name (maximum 32 characters) to each UDI instruction instance.

Parameters

                   

Parameters displays the list of UDI parameters defined with Assignment Required and or Visible checked in the definition.

Devices

                   

Allow users to choose which UDI Device to associate with a Hardware Configuration Device in the project.

Name

                   

Displays the parameter name.

Type

                   

Indicates the parameter data type.

Cols

                   

Indicates the number of columns defined for an array parameter.

Chars

                   

Indicates the number of characters defined for string parameters

Default Input Value

                   

Indicates the default beginning value of a parameter when the UDI is executed, if it does not have a tag assignment. This only applies to parameters with In, In/Out, and Local scopes.

*See note 2 above

.

Scope

                   

Indicates how the parameter is used. Possible scopes are In, Out, In/Out, and Local.

Assignment Required

                   

Indicates whether a Tag or value must be assigned to the parameter.

Comment

                   

Use this field to add comments associated with the parameter.

Tag

 

This field allows the user to assign Global Tags or Constant Values for the UDI parameters. If a parameter requires assignment, than a Global Tag or Constant value must be entered in this field.

Use Structure

                   

Enables the use of Structure for elements of the chosen UDI definition.

Name

                   

Indicates the name of the device.

Device

                   

Indicates the device definition assigned.

Device Type

                   

Indicates the specific type of device assigned. Not all devices will have a Device Type defined.

Configured Device

                   

This field allows the user to choose from the list of available devices that have been defined in the project Hardware Configuration that match the UDI device.


Example of creating / instantiating a UDI that requires a device assignment:

  1. Go to Hardware Configuration and create a Modbus Device.
  2. In the Task Management panel in main ladder, select the task where the UDI instance will be created and drag-and-drop the UDI instruction to the desired rung (or type UDI) to instantiate a configured UDI
  3. Select the UDI Definition to be used from the drop-down list.
  4. Assign a unique Name to this UDI instruction and assign tags for each parameter in the table or select Use Structure.
  5. Select the Devices tab and select a configure device from the dropdown menu.

    Note: A configured device must already be set up in Hardware Configuration to associate the UDI Device to a device in the project.


Related Topics:

Related Topics Link IconRelated Topics