beautypg.com

Figure 11.8—add1 function block – Watlow LogicPro User Manual

Page 196

background image

Chapter 11: User Defined Function Blocks

LogicPro User’s Guide

180

Watlow Anafaze

Doc.# 28002-00 Rev 3.00

Figure 11.8 ADD1 Function Block

Use the following steps to define the UDFB:

1.

Select

File

.

2.

Select

New

.

3.

Select

User Defined Function Block

. The

Add

UDFB

dialog box appears.

4.

Enter

Example 1 Add

as the Long Name in the

Long

field.

5.

Enter

ADD1

as the Short Name in the

Short

field.

6.

Click

[Insert]

in the

Inputs

group.

7.

Name the first input

EN

and set its

Type

to

Bool

.

8.

Click

[OK]

.

9.

Repeat steps 6 to 8 with the second and third inputs
Named as

A

and

B

with

Type

set to

INT

.

10. Click

[Insert]

in the

Outputs

group.

11. Name the first output as

Q

and set its

Type

to

Bool

.

12. Click

[OK]

.

13. Repeat steps 10 to 11 with the second output named as

C

with

Type

set to

INT

.

14. Click

[OK]

.

LogicPro automatically creates two files, a header file (

*.h

)

and a C file (

*.c

), and then puts these two text files on the

window. Some of the names will differ if you are using a
CPC400. In the header file, there is a structure named

Add1Struct

defined along with four function prototypes.

In the following example, it is not necessary to add additional
members to the structure.

In the C file, there are four functions. It isn’t necessary to
write any additional code in the

Init, Reset

and

Exit