Extracting String Data - Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

32.3

Extracting String Data

MID(_E)
RnPCPU
RnPCPU
RnCPU RnENCPU
(Process)
(Redundant)
These functions extract and output the specified number of characters, starting from the specified position of the string input.
Ladder, FBD/LD
[Without EN/ENO]
s
d
n1
n2
Setting data
■Description, type, data type
Argument
Description
EN
Execution condition (TRUE: Executed, FALSE: Not executed)
s (IN)
Input
n1 (L)
Number of characters to be extracted
n2 (P)
Extraction target character start position
ENO
Output status (TRUE: Normal, FALSE: Abnormal)
d
Output
Processing details
■Operation processing
• These functions extract the specified number of characters, starting from the specified position of the string input to (s), and
output the operation result from (d).
• Specify the number of characters to be extracted in (n1).
• Specify the start position of the string to be extracted in (n2).
Ex.
When (n1)=5, (n2)=5
(s)
ABCDEF12345
Upper byte
+0
42H(B)
+1
44H(D)
+2
46H(F)
+3
32H(2)
+4
34H(4)
+5
00H
• Input a STRING data type value to (s) within the range of 0 to 255 bytes.
• Input an INT data type value to (n1) within the range of 0 to 255, provided that it is within the number of characters in the
string input to (s).
• Input an INT data type value to (n2) within the range of 1 to 255, provided that it is within the number of characters in the
string input to (s).
RnSFCPU RnSFCPU
(Standard)
(Safety)
[With EN/ENO]
EN
ENO
s
d
n1
n2
Lower byte
41H(A)
43H(C)
45H(E)
Starting position specified
by (n2): 5th character
31H(1)
33H(3)
35H(5)
Number of characters
to be extracted (n1): 5
Structured text
[Without EN/ENO]
d:=MID(s,n1,n2);
[With EN/ENO]
d:=MID_E(EN,ENO,s,n1,n2);
Type
Input variable
Input variable
Input variable
Input variable
Output variable
Output variable
EF123
Upper byte
46H(F)
32H(2)
00H
Data type
BOOL
ANYSTRING_SINGLE
INT
INT
BOOL
ANYSTRING_SINGLE
(d)
Lower byte
45H(E)
+0
31H(1)
+1
33H(3)
+2
32 STRING FUNCTIONS
32.3 Extracting String Data
32
1949

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents