31
ifm
Programming Manual
ecomatmobile
CabinetController (CR0301) Runtime System V05
2016-04-21
System description
Software description
>
3.4.2
Programming notes for CODESYS projects
FB, FUN, PRG in CODESYS .............................................................................................................. 31
Calculations and conversions in the application program ................................................................... 32
Note the cycle time! ............................................................................................................................. 32
Creating application program .............................................................................................................. 33
Save boot project................................................................................................................................. 34
Using ifm downloader .......................................................................................................................... 34
7426
Here you receive tips how to program the device.
► See the notes in the CODESYS programming manual
> select your country > [Data sheet search] > CR0301 > [Operating instructions]
→
ecomatmobile
DVD "Software, tools and documentation".
>
FB, FUN, PRG in CODESYS
8473
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 must contain max. 8,000 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 FB call in a function:
• every time there is an additional initialisation call and
• the data of the last call gets lost.
Summary of Contents for Ecomat 100 Mobile CR0301
Page 212: ......