M800V/M80V Series PLC Programming Manual (1/2)
8 Function Instructions
8.10 Character String Processing Instructions
Operation errors
In the following cases, an arithmetic error occurs, the error flag (SM0) turns ON, and an error code is stored at SD0.
When the MIDR Instruction is used (Error code: 82)
- The value of (S2) exceeds the number of characters of (S1).
- The amount of (S2) and (S2 +1) exceeds the number of characters of (S1).
- The (S2+1) number of characters from position (D) exceeds the (D) device range.
- The (S2+0) value is "0".
- The value of (S2+1) is other than an effective value (-1, 0, 1 or more).
- The NULL code "00H" does not exist in the relevant device range starting from the device number designated by
(S1).
When the MIDW Instruction is used (Error code: 82)
- The value of (S2) exceeds the number of characters of (D).
- The value of (S2+1) exceeds the number of characters of (S1).
- The (S2+0) value is "0".
- The value of (S2+1) is other than an effective value (-1, 0, 1 or more).
- The NULL code "00H" does not exist in the relevant device range starting from the device number designated by
(S1).
Program example
The following program stores the 3rd character through to the 6th character from the left end of the character string stored
in the area starting from (D10) at the area starting from (D0) when X0 turns ON.
X0
0
5
b15
D10
41H (A)
31H (1)
D11
D12
45H (E)
D13
00H
R0
3
4
R1
IB-1501667-B
[Ladder mode]
MIDRP D10 D0 R0
END
[Operation]
b8b7
b0
42H (B)
32H (2)
33H (3)
44H (D)
"BA213ED"
Steps
Inst.
0
LD
1
MIDRP
5
END
b15
D
31H (1)
45H (E)
D1
D2
"213E"
352
[List mode]
Device
X0
D10
D0
R0
b8b7
b0
32H (2)
33H (3)
00H