Lenze PM94P01C Manual de usuario Pagina 47

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 134
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 46
PM94P01C 45
Programming
2.9.4 IF Structure
The “IF” statement is used to execute an instruction or block of instructions one time if a condition is true. The simplified
syntax for the IF statement is:
IF condition
…statement(s)
ENDIF
The flowchart and code segment in Figure 17 illustrate the use of the IF statement.
…statements
IF IN_A2
OUT2 = 1
MOVED 3
ENDIF
..statements
Start
Set Output 2 ON
Move Distance 3
units
End
Yes
NO
Input A2 ON?
Figure 17: IF Code and Flowchart
2.9.5 IF/ELSE Structure
The IF/ELSE statement is used to execute a statement or a block of statements one time if a condition is true and a
different statement or block of statements if condition is false.
The simplified syntax for the IF/ELSE statement is:
IF <condition>
…statement(s)
ELSE
…statement(s)
ENDIF
The flowchart and code segment in Figure 18 illustrate the use of the IF/ELSE instruction.
…statements
IF IN_A2
OUT2=1
MOVED 3
ELSE
OUT2=0
MOVED 5
ENDIF
..statements
Start
Input A2 ON?
Set Output 2 ON
Move Distance 3
units
End
Yes
Set Output 2 OFF
Move Distance 5
units
No
Figure 18: IF/ELSE Code and Flowchart
Vista de pagina 46
1 2 ... 42 43 44 45 46 47 48 49 50 51 52 ... 133 134

Comentarios a estos manuales

Sin comentarios