07.03.2014 Views

Introduction.

Introduction.

Introduction.

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Workshop PG5<br />

Program structures<br />

5.3 Function Blocks ( FB 0 to 999 )<br />

What’s a FB:<br />

FB's ( Function blocks ) are nearly the same as PB's. Similar to PB's, FB's contain<br />

program parts which can be called from other blocks. This call can be conditional or<br />

unconditional.<br />

The unique difference is that FB's give you the possibility to call the block with parameters,<br />

as where with PB’s, you cannot.<br />

FB's with parameters can only be called from an IL program.<br />

The following example shows a FB which makes an output blink.<br />

The FB is called twice. First it makes the output 64 blink at a rate of 1.5 seconds<br />

and the second output 65 at a rate of 3 seconds.<br />

Call a FB:<br />

; Function block program<br />

FB 1 ; Function Block 1<br />

STL =2 ;If timer = L<br />

LDL =2 ; then load the time<br />

=3<br />

COM =1<br />

EFB<br />

; and toggle the output<br />

;The FB ends here<br />

; End function block<br />

; Main program<br />

;-------------------<br />

COB 0 ;Program start<br />

0<br />

;Call function block<br />

CFB 1 ;Call the FB 1<br />

O 64<br />

T 1<br />

15<br />

;Call function block<br />

CFB 1 ; Call the FB 1<br />

O 65<br />

T 2<br />

30<br />

ECOB<br />

;End main program<br />

© SAIA-Burgess Controls AG Page 5-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!