EasyManua.ls Logo

IFM Electronic CR0403 - Programming Notes for CODESYS Projects

IFM Electronic CR0403
233 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
31
ifm Programming Manual ecomatmobile BasicController (CR0403) Runtime System V03.02 2015-04-01
System description Software description
>
3.4.2 Programming notes for CODESYS projects
FB, FUN, PRG in CODESYS .............................................................................................................. 31
Note the cycle time! ............................................................................................................................. 32
Creating application program .............................................................................................................. 33
Using ifm maintenance tool ................................................................................................................. 34
Distribution of the application program ................................................................................................ 34
7426
Here you receive tips how to program the device.
► See the notes in the CODESYS programming manual
→ www.ifm.com > select your country > [Data sheet search] > CR0403 > [Operating instructions]
→ ecomatmobile DVD "Software, tools and documentation".
>
FB, FUN, PRG in CODESYS
15410
In CODESYS we differentiate between the following types of function elements:
FB = function block
• An FB can have several inputs and several outputs.
• An FB may be called several times in a project.
• An instance must be declared for each call.
• Permitted: Call FB and FUN in FB.
FUN = function
• A function can have several inputs but only one output.
• The output is of the same data type as the function itself.
PRG = program
• A PRG can have several inputs and several outputs.
• A PRG may only be called once in a project.
• Permitted: Call PRG, FB and FUN in PRG.
NOTE
Function blocks must NOT be called in functions!
Otherwise: During execution the application program will crash.
All function elements must NOT be called recursively, nor indirectly!
An IEC application may contain maximum 8000 function elements; in this device maximum 512
function elements!
Background:
All variables of functions...
• are initialised when called and
• become invalid after return to the caller.
Function blocks have 2 calls:
• an initialisation call and
• the actual call to do something.
Consequently that means for the function block call in a function:
• every time there is an additional initialisation call and
• the data of the last call gets lost.

Table of Contents

IFM Electronic CR0403 - Programming Notes for CODESYS Projects