257
4
4 Instructions 4.6.4 Matrix Rotation and Shift
RIGHT: String read right
◆
Overview
The RIGHT instruction retrieves a designated number of characters at the right end of a string.
RIGHT S D n
String read right Applicable model:
H3U
S Source data Start number of elements that store a string
16-bit instruction (7
steps)
RIGHT: Continuous
execution
RIGHTP: Pulse
execution
D
Retrieval
result
Start number of elements that store a retrieved
string
n
Retrieved
character
count
Number of characters to be retrieved
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM V Z Modication K H E
D X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM V Z Modication K H E
n X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM V Z Modication K H E
Note: The elements in gray background are supported.
◆
Function
n characters are retrieved at the right end of a string from head address [S]. The result is stored in elements
from head address [D].
ASCII code of the
second character
ASCII code of the
fourth character
S+1
b7 -----b0
ASCII code of the (last
character number – N +
2) th character
ASCII code of the
first
character
ASCII code of the
third
character
b15----- b8
00H
ASCII code of the
last character
S
……………………
ASCII code of the (last
character number – N +
1) th character
ASCII code of the (last
character number – N +
4) th character
ASCII code of the (last
character number – N +
3) th character
ASCII code of the (last
character number –
1) th
character
ASCII code of the (last
character number –
2) th
character
D+1
b7-----b0
ASCII code of the (last
character number – N +
2) th character
b15-----b8
00H
ASCII code of the
last character
D
……………………
ASCII code of the (last
character number – N +
1) th character
ASCII code of the (last
character number – N +
4) th character
ASCII code of the (last
character number – N +
3) th character
ASCII code of the (last
character number – 1) th
character
ASCII code of the (last
character number – 2) th
character
The retrieved string is appended with 00H when stored.
1. When the number of retrieved characters is odd, 00H is stored in the higher byte of the element that
stores the last character.
2. When the number of retrieved characters is even, 0000H is stored in the element after the one that
stores the last character.
3. When the number of retrieved bytes is 0, 0000H is stored in [D].