beautypg.com

Defining a new or editing an existing udfb – Watlow LogicPro User Manual

Page 184

background image

Chapter 11: User Defined Function Blocks

LogicPro User’s Guide

168

Watlow Anafaze

Doc.# 28002-00 Rev 3.00

When a UDFB is defined, LogicPro generates two associated
files:

A header file.

A C code file.

The header file contains the definition of a structure for that
UDFB and function prototypes. The C file contains four
functions:

Main Program

- called during evaluation of the user Program

and performs the task of the UDFB.

Initialization

- called only once, when the user Program starts

to run.

Reset

- called only when the UDFB is in an unstored action

and that action becomes inactive.

Exit

- called once, if the user Program terminates.

In most cases, you will not use the initialization, exit, and reset
functions; therefore, you will not need to add code to those
functions.

Defining a New or Editing an Existing UDFB

In order to create a new UDFB the user must first open or
create a Project and a Resource.

To create a new UDFB:

1.

Select the

File

menu.

2.

Select

New

.

3.

Select

User Defined Function Block

. The

New

UDFB

dialog box appears, as shown in Figure 11.1 on

page 169.

4.

Enter the complete name of the UDFB in the

Long

field.

This is the name of the UDFB as it appears in the list of
available UDFBs in the Ladder diagram editor. The Long
name is limited to 27 characters or less.

5.

Enter an abbreviated name for the UDFB in the

Short

field. The Short name is the label that is placed at the top
of the graphical representation of the Function Block as
it appears in the Program editor.

The Short name must:

Use a letter from A to Z for the first character.

Be 4 characters or less in length.

Not use a space or other illegal character.