![background image](http://html1.mh-extra.com/html/omron/sysmac-cs1d-cpu/sysmac-cs1d-cpu_reference-manual_7422681270.webp)
1231
Text String Processing Instructions
Section 3-33
Description
RGHT$(653) reads the number of characters designated by S2, from the left
(the beginning) of the first word of the text string designated by S1 until the
NUL code (00 hex), and outputs the result to D (with NUL added at the end).
If the number of characters to be read exceeds the number of characters des-
ignated by S1, the entire S1 text string will be output.
If 0 (0000 hex) is designated as the number of characters to be read, the two
NUL characters (0000 hex) will be output to D.
Note
RGHT$(653) can be processed in the background. Refer to the
SYSMAC CS/
CJ/NSJ Series PLC Programming Manual
(W394) for details.
Flags
Precautions
The maximum number of characters to be read that can be designated by S2
is 4,095 (0FFF hex). If more than that are designated, an error will be gener-
ated and the Error Flag will turn ON.
If 0000 (hex) is output to D, the Equals Flag will turn ON.
Example
In this example, RGHT$(653) is used to read four characters.
3-33-6 GET STRING MIDDLE: MID$(654)
Purpose
Reads a designated number of characters from any position in the middle of a
text string.
Ladder Symbol
Name
Label
Operation
Error Flag
ER
ON if more than 4,095 characters are designated by S1.
ON if more than 4,095 characters (0FFF hex) are desig-
nated by S2.
ON if the Communications Port Enabled Flag for the com-
munications port number specified as the
Com Port num-
ber
for
Background Execution
is OFF when background
processing is specified.
OFF in all other cases.
Equals Flag
=
ON if 0000 (hex) is output to D.
OFF in all other cases.
S1:
D:
S2: D00200
Text string CDEF
Four characters
(bytes) read.
Text string ABCDEF
MID$(654)
S1
S2
S3
D
S1
: Text string first word
S2
: Number of characters
S3
: Beginning position
D
: First destination word
Summary of Contents for SYSMAC CS1D-CPU**
Page 3: ...iv...
Page 29: ...xxx...
Page 185: ...146 List of Instructions by Function Code Section 2 4...
Page 1389: ...1350 CJ series Instruction Execution Times and Number of Steps Section 4 2...
Page 1390: ...1351 Appendix A ASCII Code Table ASCII SP Four leftmost bits Four rightmost bits...
Page 1391: ...1352 ASCII Code Table Appendix A...