Boolean instructions. Schneider Electric PL7 Micro/Junior/Pro - Detailed
Iklan
Iklan
1.2
Boolean instructions
Introduction
Aim of this section
What's in this
Section?
This section describes the PL7 language boolean instructions
This Section contains the following Maps:
Topic
Bit object instructions
Definition of the main boolean objects
Loading instructions
Assign instructions
AND Logic Instruction
OR Logic Instruction
Exclusive OR Instructions
Standard instructions
Page
TLX DR PL7 xxE
15
Standard instructions
Bit object instructions
Bits instructions The following instructions apply to bit objects.
Designation
:=
OR
AND
XOR
NOT
RE
FE
SET
RESET
Function
Assignment of a bit boolean OR boolean AND boolean exclusive OR
Inversion
Rising edge
Falling edge
Set to 1:
Set to 0:
Bits table instructions
The following instructions apply to bits table objects.
Designation
Table:= Table
Table:= Word
Word:= Table
Table:= Double word
Double word: = Table
COPY_BIT
AND_ARX
OR_ARX
XOR_ARX
NOT_ARX
BIT_W
BIT_D
W_BIT
D_BIT
LENGHT_ARX
Function
Assignment between two tables
Assignment of a word to a table
Assignment of a table to a word
Assignment of a double word to a table
Assignment of a table to a double word
Copy of a bits table in a bits table
AND between two tables
OR between two tables exclusive OR between two tables
Negation in a table
Copy of a bits table in a word table
Copy of a bits table in a double word table
Copy of a word table in a bits table
Copy of a double word table in a bits table
Calculation of the length of a table by the number of elements
16
TLX DR PL7 xxE
Standard instructions
Definition of the main boolean objects
Description
Bits
The following table describes the main boolean objects.
Description Examples
Immediate values
0 or 1 (False or True) 0
Inputs/outputs These bits are the "logic images" of the electrical states of the inputs/ outputs.
They are stored in the data memory and updated each time the task in which they are configured is polled.
%I23.5
%Q51,2
Internal
Note: The unused input/output bits may not be used as internal bits.
The internal bits are used to store the intermediary states during execution of the program.
%M200
System
Function blocks
The system bits %S0 to %S127 monitor the correct operation of the PLC and the running of the application program.
%S10
The function block bits correspond to the outputs of the function blocks or DFB instance.
These outputs may be either directly connected or used as an object.
%TM8.Q
Word extracts With the PL7 software it is possible to extract one of the 16 bits of a word object.
%MW10:X5
Grafcet steps and macrosteps
The Grafcet status bits of the steps, macro-steps and macro-step steps are used to recognize the Grafcet status of step i, of macro-step j or of step i of the macro-step j.
%X21
%X5.9
Write access
_
No
Yes
Yes
Accordin g to i
No
Accordin g to the type of words
Yes
Yes
TLX DR PL7 xxE
17
Standard instructions
Loading instructions
Role
Ladder
P
N
The following table describes the role of each of the instructions.
Instruction list Structured text
LD :=
Description
Normally open contacts: contact made
(result at 1) when the controlling bit object is at state 1.
Timing diagram
Opérande
Résultat
LDN :=NOT Normally closed contacts: contact made
(result at 1) when the controlling bit object is at state 0.
Opérande
Résultat
LDR
LDF
:=RE
:=FE
Rising edge contacts: detect controlling bit object changing from 0 to 1.
Setting the result to 1 takes 1 cycle to complete.
Falling edge contacts: detect controlling bit object changing from 1 to 0.
Setting the result to 1 takes 1 cycle to complete.
Opérande
Résultat
Opérande
Résultat
Permitted operands
Ladder
The following table gives a list of the operands used for these instructions.
Instruction list Structured text
LD :=
Operands
%I,%Q,%M,%S,%BLK,%•:Xk, %Xi, (True and False in instruction list or structured text)
LDN
LDR
:=NOT
:=RE
%I,%Q,%M,%S,%BLK,%•:Xk, %Xi, (True and False in instruction list or structured text)
%I,%Q,%M
P
LDF :=FE %I,%Q,%M
N
18
TLX DR PL7 xxE
Example in ladder
Standard instructions
The following example shows how to program the loading instructions in ladder format.
%I1.1
%Q2.3
%M0 %Q2.2
%Q2.4
%I1.2
P
%I1.3
N
%Q2.5
Example in instruction list
The following example shows how to program the loading instructions in Instruction
List language.
LD %I1.1
ST %Q2.3
LDN %M0
ST %Q2.2
LDR %I1.2
ST %Q2.4
LDF %I1.3
ST %Q2.5
Example in structured text
The following example shows how to program the loading instructions in structured text language.
%Q2.3:=%I1.1;
%Q2.2:=NOT %M0;
%Q2.4:=RE %I1.2;
%Q2.5:=FE %I1.3;
TLX DR PL7 xxE
19
Standard instructions
Assign instructions
Role The following table describes the role of each of the instructions.
Timing diagram Language data
Instruction list Structured text
Description
ST := to the direct coils the associated bit object takes the value of the equation result.
Operand
Result
STN :=NOT
S
R
S
R
SET
RESET to the negated coils: the associated bit object takes the inverse value of the equation result.
Operand
Result to the set coils: the associated bit object is set when the result of the equation is set Operand
Result to the trigger coils: the associated bit object is clear when the result of the equation is set.
Operand
Result
Permitted operands
The following table gives a list of the operands used for these instructions
Language data
Instruction list
ST
Structured text
:=
Operands
%I,%Q,%M,%S,%•:Xk
S
R
STN
S
R
:=NOT
SET
RESET
%I,%Q,%M,%S,%•:Xk
%I,%Q,%M,%S,%•:Xk,%Xi
Only in the preliminary processing.
%I,%Q,%M,%S,%•:Xk,%Xi
Only in the preliminary processing.
20
TLX DR PL7 xxE
Example in language data
Standard instructions
The following example shows how to program the assign instructions in language data.
%I1.1
%Q2.3
%Q2.2
%I1.2
%Q2.4
S
%Q2.4
R
Example in instruction list
The following example shows how to program the assign instructions in instruction list language.
LD %I1.1
ST %Q2.3
STN %Q2.2
S %Q2.4
LD %I1.2
R %Q2.4
Example in structured text
The following example shows how to program the assign instructions in structured text language.
%Q2.3 := %I1.1;
%Q2.2 := NOT %I1.1;
IF %I1.1 THEN
SET %Q2.4;
END_IF;
IF %I1.2 THEN
RESET %Q2.4;
END_IF;
TLX DR PL7 xxE
21
Standard instructions
AND Logic Instruction
Role
Language data
P
N
The following table describes the role of each of the instructions
Instruction list Structured text
AND AND
Description
AND logic between the operand and the previous instruction’s Boolean result
Timing diagram
AND
%I1.1
ANDN AND
(NOT...)
AND logic between the operand inverse and the previous instruction’s Boolean result
%M1
%Q2.3
ANDN
%M2
ANDR
%I1.2
%Q2.2
ANDR AND (RE...) AND logic between the operand’s rising edge and the previous instruction’s Boolean result
(2) Setting during 1 cycle
ANDF
%I1.3
%I1.4
%Q2.4 (2)
ANDF
AND (FE...) AND logic between the operand’s falling edge and the previous instruction’s Boolean result
(2) Setting during 1 cycle
%M3
%I1.5
%Q2.5 (2)
22
TLX DR PL7 xxE
Standard instructions
Permitted operands
Language data
The following table gives a list of the operands used for these instructions
Instruction list Structured text
AND AND
ANDN
ANDR
AND (NOT...)
AND (RE...)
Operands
%I, %Q, %M, %S, %BLK, %•:Xk, %Xi
True (1)/False (0) in instruction list language or structured text
%I, %Q, %M, %S, %BLK, %•:Xk, %Xi
True (1)/False (0) in instruction list language or structured text
%I, %Q, %M
P
ANDF AND (FE...) %I, %Q, %M
N
Example in language data
The following example shows how to program the AND Logic instructions in language data.
%I1.1 %M1 %Q2.3
%M2 %I1.2
%I1.3 %I1.4
P
%M3 %I1.5
N
%Q2.2
%Q2.4
%Q2.5
TLX DR PL7 xxE
23
Standard instructions
Example in instruction list
The following example shows how to program the AND Logic instructions in the
Instruction List.
LD %I1.1
AND %M1
ST %Q2.3
LD %M2
ANDN %I1.2
ST %Q2.2
LD %I1.3
ANDR %I1.4
ST %Q2.4
LD %M3
ANDF %I1.5
ST %Q2.5
Example in structured text language
The following example shows how to program the AND Logic instructions in structured text language.
%Q2.3:=%I1.1 AND %M1;
%Q2.2:=%M2 AND (NOT%I1.2);
%Q2.4:=%I1.3 AND (RE%I1.4);
%Q2.5:=%M3 AND (FE%I1.5);
24
TLX DR PL7 xxE
Standard instructions
OR Logic Instruction
Role
Language data
P
N
The following table describes the role of each of the instructions
Structured text Description Instruction list
OR OR OR logic between the operand and the previous instruction’s Boolean result
Timing diagram
OR
%I1.1
%M1
ORN
ORR
OR (NOT...)
OR (RE...)
OR logic between the operand inverse and the previous instruction’s Boolean result
OR logic between the operand’s rising edge and the previous instruction’s Boolean result
%Q2.3
ORN
%M2
%I1.2
%Q2.2
ORR
ORF OR (FE...) OR logic between the operand’s falling edge and the previous instruction’s Boolean result.
%I1.3
%I1.4
%Q2.4
ORF
%M3
%I1.5
%Q2.5
TLX DR PL7 xxE
25
Standard instructions
Permitted operands
Language data
The following table gives a list of the operands used for these instructions
Instruction list Structured text
OR OR
ORN
ORR
OR (NOT...)
OR (RE...)
Operands
%I, %Q, %M, %S, %BLK, %•:Xk, %Xi
True (1)/False (0) in instruction list language or structured text
%I, %Q, %M, %S, %BLK, %•:Xk, %Xi
True (1)/False (0) in instruction list language or structured text
%I, %Q, %M
P
ORF OR (FE...) %I, %Q, %M
N
Example in language data
The following example shows how to program the OR Logic instructions in language data.
%I1.1
%Q2.3
%M1
%M2
%I1.2
%I1.3
%Q2.2
%Q2.4
%I1.4
P
%M3
%I1.5
N
%Q2.5
26
TLX DR PL7 xxE
Example in instruction list
Standard instructions
The following example shows how to program the OR Logic instructions in the
Instruction List.
LD %I1.1
OR %M1
ST %Q2.3
LD %M2
ORN %I1.2
ST %Q2.2
LD %I1.3
ORR %I1.4
ST %Q2.4
LD %M3
ORF %I1.5
ST %Q2.5
Example in structured text language
The following example shows how to program the OR Logic instructions in structured text language.
%Q2.3:=%I1.1 OR %M1;
%Q2.2:=%M2 OR (NOT%I1.2);
%Q2.4:=%I1.3 OR (RE%I1.4);
%Q2.5:=%M3 OR (FE%I1.5);
TLX DR PL7 xxE
27
Standard instructions
Exclusive OR Instructions
Role
Instruction list
XOR
The following table describes the role of each of the instructions
Structured text Description Timing diagram
XOR OR Exclusive between the operand and the previous instruction’s Boolean result
XOR
%I1.1
XORN
XORR
XORF
XOR (NOT...) OR Exclusive between the operand inverse and the previous instruction’s Boolean result
XOR (RE...)
XOR (FE...)
OR Exclusive between the operand’s rising edge and the previous instruction’s Boolean result
OR Exclusive between the operand’s falling edge and the previous instruction’s Boolean result.
%M1
%Q2.3
XORN
%M2
%I1.2
%Q2.2
XORR
%I1.3
%I1.4
%Q2.4
XORF
%M3
%I1.5
%Q2.5
Note: There are no specific graphic elements for the OR exclusive in language data. However the OR exclusive can be programmed by using a combination of opening and closing contacts (see example below).
28
TLX DR PL7 xxE
Standard instructions
Permitted operands
The following table gives a list of the operands used for these instructions
Instruction list Structured text
XOR XOR
XORN
XORR
XORF
XOR (NOT...)
XOR (RE...)
XOR (FE...)
Operands
%I, %Q, %M, %S, %BLK, %•:Xk, %Xi
%I, %Q, %M, %S, %BLK, %•:Xk, %Xi
%I, %Q, %M
%I, %Q, %M
Example in language data
The following example shows how to program the OR Exclusive instructions in language data.
%I1.1 %M1 %Q2.3
%M1 %I1.1
%M2 %I1.2
%I1.2 %M2
%Q2.2
Example in instruction list
The following example shows how to program the OR Exclusive instructions in the
Instruction List:
LD %I1.1
XOR %M1
ST %Q2.3
LD %M2
XORN %I1.2
ST %Q2.2
LD %I1.3
XORR %I1.4
ST%Q2.4
LD %M3
XORF %I1.5
ST %Q2.5
TLX DR PL7 xxE
29
Standard instructions
Example in structured text language
The following example shows how to program the OR Exclusive instructions in structured text language.
%Q2.3:=%I1.1 XOR%M1;
%Q2.2:=%M2 XOR (NOT%I1.2);
%Q2.4:=%I1.3 XOR (RE%I1.4)
%Q2.5:=%M3 XOR (FE%I1.5);
Note: The brackets are optional but make the program readable
30
TLX DR PL7 xxE
Unduh
Iklan