Download Print this page

Danfoss MCO 305 Design Manual page 117

Hide thumbs Also See for MCO 305:

Advertisement

MCO 305 Design Guide
IF . . THEN . . , ELSEIF . . THEN . . ELSE . . ENDIF
Summary
Syntax
Parameter
Description
Command Group
Cross Index
Syntax Example
Program Sample
__ Software Reference __
Conditional single or multiple program branching.
(When the conditions are fulfilled, then . . . , else . . . )
IF condition THEN command
ELSEIF condition THEN command
ELSE command
ENDIF
condition = Branching criteria
command = one or more program commands
Conditional program branching can be realized with the IF..ENDIF construction.
When the conditions following IF or ELSEIF are fulfilled, then the commands
leading to the next ELSEIF, ELSE or ENDIF are carried out – and the program will
be continued after the ENDIF instruction.
When the conditions are not fulfilled, then the following ELSEIF branching will be
checked and, in as much as the conditions are fulfilled, the corresponding program
part will be carried out, and the program continued after ENDIF.
The branching conditions that are checked after IF or ELSEIF can be made up of
one or more comparison operations.
Any number of ELSEIF branching can occur within an IF...ENDIF construction –
however, only one ELSE instruction should be available. Following the ELSE
instruction is a program part that must be carried out, in as much as none of the
conditions are fulfilled.
The ELSEIF and ELSE instructions can, but do not have to be, contained within an
IF ENDIF construction.
NB!:
After a condition has been fulfilled, the appropriate program part will be carried out
and the program following the ENDIF instruction continued. Further conditions will
no longer be checked.
CON
REPEA T .. UNTIL, WHILE . . ENDWHILE
/* simple branch */
IF (a == 1) THEN
command line 1
command line n
ENDIF
/* multiple branch */
IF (a == 1 AND b != 1) THEN
command lines
ELSEIF (a == 2 AND b != 1) THEN
command lines
ELSEIF (a == 3) THEN
command lines
ELSE
command lines
ENDIF
IF_01.M, ERROR_01.M, EXIT_01.M, HOME_01.M, IN_01.M, ...
®
MG.33.L4.02 – VLT
is a registered Danfoss trademark
/* Variable a = 1, then */
117

Advertisement

loading