Get String Middle: Mid$(654) - Omron SYSMAC CJ - REFERENCE MANUAL 01-2008 Reference Manual

Sysmac cs/cj/one nsj series programmable controllers
Table of Contents

Advertisement

Text String Processing Instructions
Description
Flags
Precautions
Example

3-33-6 GET STRING MIDDLE: MID$(654)

Purpose
Ladder Symbol
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.
Name
Error Flag
ER
Equals Flag
=
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.
In this example, RGHT$(653) is used to read four characters.
Text string ABCDEF
S1:
Reads a designated number of characters from any position in the middle of a
text string.
MID$(654)
S1
S2
S3
D
Label
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.
ON if 0000 (hex) is output to D.
OFF in all other cases.
S2: D00200
Four characters
(bytes) read.
S1: Text string first word
S2: Number of characters
S3: Beginning position
D: First destination word
Section 3-33
Operation
Text string CDEF
D:
1231

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents