617
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
26 Character String Control – FNC200 to FNC209
26.6 FNC205 – LEFT / Extracting Character String Data from the Left
21
FN
C
160-FN
C
169
R
eal
Ti
m
e
C
loc
k
C
ont
ro
l
22
FN
C
170
-F
N
C
17
9
E
xt
e
rnal
D
evi
ce
23
FN
C
180
Su
b
st.
I
n
str
. I
n
fo
24
FN
C
181-FN
C
189
O
ther
s
25
FN
C
190-FN
C
19
9
B
loc
k D
a
ta
O
per
at
io
n
26
FN
C
200-FN
C
209
C
har
act
e
r St
ring
C
ont
ro
l
27
F
N
C2
10
-F
NC
21
9
Da
ta
O
per
at
ion 3
28
FN
C
220-FN
C
24
9
Da
ta
Co
m
p
a
ris
o
n
29
FN
C
250-FN
C
269
Da
ta
T
a
b
le
O
per
at
io
n
30
FN
C
27
0-F
N
C
274
Ex
-D
ev
ic
e
In
ve
rte
r C
o
mm
s
Explanation of function and operation
1. 16-bit operation (LEFT and LEFTP)
“n” characters are extracted from the left end (that is, from the head) of the character string data stored in
and later and stored to
and later.
If the number of characters specified by “n” is “0”, the NULL code (00H) is stored to
.
When characters are extracted from a character string, "00H” is automatically added at the end of the
extracted characters.
- When the number of extracted characters is odd, “00H” is stored in the high-order byte of a device
storing the last character.
- When the number of extracted characters is even, “0000H” is stored in a device next to the device
storing the last character.
• A character string stored in
and later indicates data stored in devices from the specified device until
"00H" is detected at first in units of byte.
Cautions
When handling character codes other than ASCII codes, note the following contents:
• The number of characters is handled in units of byte (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.
S
D
D
FNC205
LEFT
b15----------------------b8b7-----------------------b0
+1
ASCII code for 2nd
character
ASCII code for 4th
character
D
S
S
n
ASCII code for 1st
character
ASCII code for 3rd
character
ASCII code for n-1
character
ASCII code for n-2
character
+1
D
ASCII code for n+1
character
ASCII code for n
character
00H
ASCII code for last
character
b15----------------------b8b7-----------------------b0
ASCII code for 2nd
character
ASCII code for 4th
character
ASCII code for 1st
character
ASCII code for 3rd
character
ASCII code for n-1
character
ASCII code for n-2
character
00H
ASCII code for n
character
Command
input
D
S
31H(1)
42H(B)
41H(A)
44H(D)
43H(C)
46H(F)
45H(E)
31H(1)
ASCII code for 7th character
+1
+2
S
S
S
+4
S
+3
S
+5
S
In the case of "n = 7"
b15----------------------b8b7----------------------b0
32H(2)
34H(4)
33H(3)
00H
35H(5)
"ABCDEF12345"
D
D
+1
+2
42H(B)
41H(A)
44H(D)
43H(C)
46H(F)
45H(E)
"ABCDEF1"
b15----------------------b8b7-----------------------b0
D
00H
+3
D
ASCII code for 1st character
S