Professional Documents
Culture Documents
PLC371 Programming in Instruction List (IL)
PLC371 Programming in Instruction List (IL)
Basic instructions in IL: LD (LoaD) the contents of the variable is stored in the memory. LDN (LoaDNot) the inverted status of the variable is stored in the memory. AND is a logic AND function. OR is a logic OR function. ST (STore) the result of the memory is given to the variable following the ST. S (Set) a coil is set R (Reset) a coil is reset. Example: LD Start (Loads the status of the Start button into the memory) AND Stop (performs a logical AND with the status of Stop button, and places the result in the memory) ST L_Work (Loads the result of the memory in L_Work)
DC-B/Holtmann, Martin
Programming in IL
March 8, 2013
Programming in IL
Example: LD Start AND Stop S L_Work If the Start button is released L_work will stay 1. To switch L_Work off the Reset function must be used Example: LDN Stop R L_Work
DC-B/Holtmann, Martin
Programming in IL
March 8, 2013
Programming in IL
NOTE! (*Comment*) (* is the start of a comment. *) is the end of a comment.
Operator LD ST N N
Modifiers
Meaning Loads the (negated) value of the operand into the accumulator. Stores the (negated) content of the accumulator into the operand variable. LD iVar ST iErg
Example
Sets the operand (type BOOL) to TRUE when the content of the accumulator is TRUE.
S bVar1
Sets the operand (type BOOL) to FALSE when the content of the accumulator is TRUE . Bitwise AND of the accumulator and the (negated) operand Bitwise OR of the accumulator and the (negated) operand Bitwise exclusive OR of the accumulator and the (negated) operand Bitwise negation of the accumulator's content Addition of accumulator and operand, result is copied to the accumulator .
ADD (iVar1,iVar2)
SUB
SUB iVar2
MUL
MUL iVar2
DIV
DIV 44
GT
Check if accumulator is greater than or equal to the operand, result (BOOL) is copied into the accumulator; >= GT 23
GE
Check if accumulator is greater than or equal to the operand, result (BOOL) is copied into the accumulator; >= GE iVar2
EQ
Check if accumulator is equal to the operand, result (BOOL) is copied into the accumulator; =
EQ iVar2
NE
Check if accumulator is not equal to the operand, result (BOOL) is copied into the accumulator; <>
NE iVar1
LE
Check if accumulator is less than or equal to the operand, result (BOOL) is copied into the accumulator; <=
LE 5
( CN CN
Check if accumulator is less than operand, result (BOOL) is copied into the accumulator; < Unconditional (conditional) jump to the label (Conditional) call of a PROGRAM or FUNCTION_BLOCK (if accumulator is TRUE) Early return of the POU and jump back to the calling POU
Conditional - if accumulator is TRUE, )early return of the POU and jump back to the calling POU
CN
Conditional - if accumulator is FALSE )early return of the POU and jump back to the calling POU Evaluate deferred operation March 8, 2013
RETCN
Bij de variabelen moet de variabele Blok_5 To_Count = defined0 counter CTU Var_1 is the count pulse (CU) Var_2 is the reset puls (RESET) To count (PV) is the preset amount of counts wanted Q is the output of the counter which will go to a state of 1 when the counted pulses is equal to the To_Count Value (CV) is the amount of conted pulses
Value = 0
In the program we write, CAL Block_5 (CU:=Var_1, RESET:=Var_2, PV:= To_Count) The variables must be given a Type. Block_5 : CTU; Var_1: BOOL; Var_2: BOOL; PV: INT; LD Block_5.Q ST Lamp LD Block_5.CV ST Value Lamp: BOOL; Value: INT;
March 8, 2013 4
DC-B/Holtmann, Martin
Programming in IL
DC-B/Holtmann, Martin
Programming in IL
March 8, 2013