Omron CJ - INSTRUCTIONS Reference Manual page 1136

Table of Contents

Advertisement

3. Instructions
Operand Specifications
Word addresses
Area
CIO
WR
HR
S1, S2
S3, S4
OK
OK
OK
D
Flags
Name
Error Flag
Equal Flag
Function
PLC$(661) replaces part of the text string
designated by S1, from the beginning position
designated by S4, with the text string
designated by S2, and outputs the result to D
as text string data (with NUL added at the end).
The number of characters to be replaced is
designated by S3.
• The maximum number of characters in the result is 4,095 (0FFF hex). If the number is greater than
that, only 4,095 characters will be output (with NUL added as the 4,096th).
• From 0 to 4,095 characters (0000 to 0FFF hex) can be replaced. If the number is 0, then the text
string designated by S1 will be output to D just as it is, with no change. If the S2 text string is NUL,
then the operation will be the same as deleting the designated range of text in S1.
• If the S1 text string from beginning to end is replaced by NUL, then two NUL characters (0000 hex)
will be output to D. RPLC$(661) can be processed in the background. Refer to the SYSMAC
CS/CJ/NSJ Series PLC Programming Manual (W394) or the CJ2 CPU Unit Software Operation
Manual (W473) for details.
Precaution
• Set the first destination word D so that it does not overlap with the areas set with the replacement text
string first word S2. RPLC$(654) will not work correctly if these areas overlap.
Example Programming
In this example, RPLC$(654) is used to replace three characters.
D100
D200
D300
D500
D400
1098
AR
T
C
DM
EM
OK
OK
OK
OK
OK
Label
ER
• ON if more than 4,095 characters are designated by S1 or S2.
• ON if more than 4,095 characters (0FFF hex) are designated by S3.
• ON if the S4 data is not within the range of 1 to 4,095 (0001 to 0FFF hex).
• ON if the Communications Port Enabled Flag for the communications port number specified as the
Com Port number 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.
Text string ABCDEFGHI
S1: D100
D101
D
D103
D104
Indirect DM/EM
addresses
Con-
stants
@DM
*DM
DR
@EM
*EM
---
---
OK
OK
OK
OK
---
---
Operation
S1
A
B
C
D
E
F
G
H
I
NUL
S3: D300
Three characters replaced
D2: D200
Text string M
D4: D500
From 5th byte.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Registers
Flags
Pulse
bits
Indirect
IR
TK
CF
using IR
---
OK
---
---
S3
00
04
D
A
C
K
NUL
S2
K
NUL
S4
00
05
Text string ABCDMHI
D: D400
D401
D402
D403
TR
bits
---
---
B
D
I
NUL

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents