Mitsubishi Electronics FX3G User Manual

Page of 964
629
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
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
FNC160
-F
NC1
69
R
eal
 T
ime C
lock
 
C
ontrol
22
FNC17
0-F
NC
179
E
xternal D
evice
23
FNC
180
Alternate 
Instructions
24
FN
C181-
FNC18
9
O
thers
25
FNC190
-F
NC1
99
Bl
oc
k D
ata
 
Op
er
ation
26
FNC20
0-F
NC209
C
har
ac
te
r S
trin
Con
tro
l
27
FNC2
10-
FNC21
9
Dat
Operati
on 3
28
FNC220
-F
NC2
49
Da
ta 
C
omp
ari
son
29
FNC25
0-F
N
C
269
D
ata T
abl
Operation
30
FNC2
70-
FNC276
Ex
-Dev
ice
• A character string stored in 
 and later indicates data stored in devices from the specified device until "00H" is 
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
 (error code: K6706)
• When “n” exceeds the number of characters specified by 
 (error code: K6706)
• When the number of devices after a device number specified by 
 is smaller than the number of devices 
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, the number of characters which is equivalent to the number stored in D0 are
extracted from the left end of the character string data stored in D100 and later, and stored to R10 and later when
X010 turns ON.
31H(1)
42H(B)
41H(A)
44H(D)
43H(C)
46H(F)
45H(E)
31H(1)
ASCII code for 7th character
+1
+2


+4
+3
+5
In the case of "n = 7"
b15----------------------b8b7----------------------b0
32H(2)
34H(4)
33H(3)
00H
35H(5)
"ABCDEF12345"
+1
+2
42H(B)
41H(A)
44H(D)
43H(C)
46H(F)
45H(E)
"ABCDEF1"
b15----------------------b8b7-----------------------b0
00H
+3
ASCII code for 1st character
   
S
   
S
   
S
   
D
51H(Q)
53H(S)
4EH(N)
4FH(O)
44H(D)
48H(H)
51H(Q)
53H(S)
4EH(N)
4FH(O)
48H(H)
44H(D)
X010
R10
FNC205
LEFTP
D100
END
D0
ASCII code for 6th character
D101
D102
D104
D103
b15----------------------b8b7-----------------------b0
42H(B)
41H(A)
“SQONHDAB”
R11
R12
0000H
“SQONHD”
b15----------------------b8b7-----------------------b0
D100
R10
D0
6
R13
ASCII code for 1st character
00H