Shift instructions. Schneider Electric PL7 Micro/Junior/Pro - Detailed
โฆษณา
โฆษณา
Advanced instructions
2.3
Shift instructions
Shift instructions
General The shift instructions involve moving the bits of a word or double word operand by a number of positions to the right or left. There are two types of shift: l the logic shift: l l
SHL(op2,i) logic shift of i positions towards the left.
SHL(op2,i) logic shift of i positions towards the right.
l the rotate shift: l ROL(op2,i) rotate shift of i positions towards the left.
l ROL(op2,i) rotate shift of i positions towards the right.
If the operand which is to be shifted is a simple length operand, the variable i will be between 1 and 16. If the operand which is to be shifted is a double length operand, the variable i will be between 1 and 32. The state of the last output bit is memorized in the %S17 bit.
Illustration of the two types of shift:
Logic shift Rotate shift
15 (ou 31) 0 0
%S17
0
%S17
15 (ou 31) 0
%S17
%S17
TLX DR PL7 xxE
109
Advanced instructions
Structure Ladder language:
P
%MW0:=SHL(%MW10,5)
P
%MW10:=ROR(%KMW9,8)
Syntax
Instruction list language:
LDR %I1.1
[%MW0:= SHL(%MW10,5) ]
Structured text language:
IF RE%I1.2 THEN
%MW10:= ROR(%KW9,8) ;
END_IF;
Operators: SHL, SHR, ROL, ROR
Operands:
Type Operand 1 (Op1)
Words which can be indexed %MW
Words which can not be indexed
Double words which can be indexed
Operand 2 (Op2)
%MW, %KW, %Xi.T
%QW, %SW, %NW, %BLK Imm.val., %IW, %QW, %SW,
%NW, %BLK, Expr. num.
%MD %MD, %KD
Double words which can not be indexed
%QD, %SD Imm.val., %ID, %QD, %SD,
Expr. num.
Syntax: Op1:=Operator(Op2,i)
110
TLX DR PL7 xxE
ดาวน์โหลด
โฆษณา