FX
/FX
/FX
Series Programmable Controllers
3G
3U
3UC
Programming Manual - Basic & Applied Instruction Edition
In the case of "n = 5"
b15----------------------b8b7-----------------------b0
S
42H(B)
S
+1
44H(D)
S
+2
46H(F)
S
+3
32H(2)
S
+4
34H(4)
S
+5
• A character string stored in
first detected in byte units.
Cautions
When handling character codes other than ASCII codes, note the following contents:
• The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes in which 2
bytes express 1 character such as shift JIS codes, the length of 1 character is detected as "2".
• When extracting characters from a character string including character codes in which 2 bytes express 1 character
such as shift JIS codes, consider the number of characters to be extracted in units of character codes for 1
character.
Note that the expected character code is not given if only 1 byte is executed out of a 2-byte character code.
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is stored in
D8067.
• When "00H" is not set within the corresponding device range after a device specified by
• When "n" exceeds the number of characters specified by
• When the number of devices after a device number specified by
required to store extracted "n" characters (that is, when "00H" cannot be stored after all character strings and the
last character) (error code: K6706)
• When "n" is a negative value (error code: K6706)
Program example
In the program example shown below, 4 characters are extracted from the right end of the character string data stored
in R0 and later, and stored to D0 and later when X000 turns ON.
X000
b15----------------------b8b7-----------------------b0
R0
41H(A)
R1
31H(1)
R2
45H(E)
41H(A)
R3
R4
ASCII code for 1st character
26.5 FNC204 – RIGHT / Extracting Character String Data from the Right
41H(A)
43H(C)
45H(E)
31H(1)
33H(3)
00H
35H(5)
"ABCDEF12345"
S
and later indicates data stored in devices from the specified device until "00H" is
FNC204
R0
D0
RIGHTP
42H(B)
32H(2)
30H(0)
46H(F)
00H
"BA210EFA"
26 Character String Control – FNC200 to FNC209
b15----------------------b8b7-----------------------b0
D
D
+1
D
+2
ASCII code for 5th character
ASCII code for 1st character
S
(error code: K6706)
D
is smaller than the number of devices
K4
END
b15----------------------b8b7-----------------------b0
D0
45H(E)
D1
41H(A)
D2
ASCII code for 4th character
32H(2)
31H(1)
34H(4)
33H(3)
00H
35H(5)
"12345"
S
(error code: K6706)
30H(0)
46H(F)
0000H
"0EFA"
21
22
23
24
25
26
27
28
29
30
629