How to Create User Function blocks using functional block diagram
user function block designed to perform a specific task and can be called multiple times throughout a program, reducing redundancy and improving maintainability. Each plc programming have standard block like timer, counter, arithmetic, comparison block but user function block are made by programmer for use multiple time like standard block. for example if we have many motors than create a user blocks to start, stop and read motor current, trip etc. user function blocks designed with multiple inputs and outputs parameter like other standard blocks. task like start stop motor, open and close gate, belt conveyor start stop etc. in this article we create very simple user function using functional block diagram and used same user function blocks in ladder and structured text programming.
add POU for user functional blocks
add POU object on your project select IEC standard and than select POU in pou dialog enter pou name and than access speicifier select internal or public if you want to use user function block for internal program than select internal or select public. follow these steps to create function blocks in abb automation builder
1. right click on application and select add object
2. add object dialog select IEC61131-3 and select pou
3. enter name of pou which used as user function blocks name
4. select access specifier
5. select programming language
6. click add
open pou and declare inputs and outputs of function blocks
declare related inputs and outputs of function blocks in this step the variable which declared in VAR_input and VAR_output as visible to other user and variable which declared in VAR not visible and only you can use these variable for internal use of functional blocks.
create a simple program for your user functional blocks
create a simple program with declared inputs and outputs. in this article we create a simple continuous pulse generator program, pulse generation is depend on user pulse duration value. in this program a on delay timer blocks, reset set blocks and comparison blocks is used. Following inputs and outputs are visible to user after functional blocks deploy.
inputs of blocks
pulse_timer_start:BOOL
pulse_timer_stop:BOOL
pulse_duration:INT
output of blocks
Pulse_output:BOOL
after program build program so you can used to another program.
call a user function blocks in main program
you can use above functional blocks in anywhere of the programmer by adding these user function blocks to program. in first we add user functional blocks in a main program. PLC_PRG is a main program of abb automation builder. PLC_PRG is used structured text for programming. follow these steps to call user function blocks in main program
1. right click and select input assistant.
2. input assistant dialog open here on categories tag select function blocks than application than select pou.
3. enter name of pou and click to ok
declare parameter of user function blocks
when user function blocks is called in other program first declared all inputs and outputs variable. use same data type as declared in user functional blocks after adding all parameter build program and if no error than download or simulate program to check proper operation of program.
call user function blocks in POU
user function blocks are designed for multiple uses. add a pou and select your programming language here we select ladder programming language to use user function blocks which are made by functional blocks diagram. follow these steps to add user functional blocks in pou
1. create a POU and select programming language which you want
2. open pou and than insert empty box on a network
3. input assistant dialog open select functional blocks and select application add pou to program