Udfb tutorial, Selecting a resource, Udfb definition – Watlow LogicPro User Manual
Page 195

LogicPro User’s Guide
Chapter 11: User Defined Function Blocks
Doc.# 28002-00 Rev 3.00
Watlow Anafaze
179
UDFB
Tutorial
The following section is an example for writing a very simple
User Defined Function Block that adds two numbers. This
section will give a detailed explanation for each step as the
development of the UDFB continues.
Selecting a Resource
The first step in writing a UDFB is to open a resource. UDFBs
are tied to specific resource platforms because of hardware
and target operation system specific dependencies.
UDFB Definition
The next step is to define the UDFB and how it will relate to
the LogicPro application Program. In this example, the UDFB
is expected to add two integers and assign the sum to a third
integer. You may also want to control when the addition
occurs through the Ladder logic.
Once the functionality of the UDFB is certain, the next step is
to design the interface between the UDFB and the LogicPro
application. This is done by listing the inputs and outputs.
The first Boolean input and output should be:
•
An enable input to enable the addition.
•
An output that indicates that the addition is valid and that
the UDFB is enabled.
These input and output are Boolean because they have either
a true or false state.
Three operands are needed to perform the addition. Operand
C will equal Operand A plus Operand B if the enable is true.
These inputs and output are of integer type. The range of an
integer is -32,768 to 32,767.
Finally the two names for the Function Blocks must be
defined. One name is a long name that appears in the list of
UDFBs when programming Ladder logic. This name can be
up to 27 characters in length. The other is the short label that
appears at the top of the UDFB in the graphical Ladder
environment. This label can be up to 4 characters in length.
Figure 11.8 shows how the Function Block looks in a
program.