Mitsubishi Electronics FX3G User Manual

Page of 964
635
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.8 FNC207 – MIDW / Random Replacement of Character Strings
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
Cautions
This instruction can handle character codes other than ASCII codes, but please note the following:
• 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 code, the length of 1 character is regarded as 2 characters.
• When overwriting 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 overwritten 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 
 or 
 (error 
code: K6706)
• When the value specified by 
 exceeds the number of characters of the character string stored in 
 and 
later (error code: K6706)
• When the number of characters specified by 
+1 exceeds the number of characters specified by 
 (error 
code: K6706)
• When 
 specifies a negative value (error code: K6706)
• When 
+1 specifies “-2” or less (error code: K6706)
Program example
In the program example shown below, 4 characters are extracted from the character string data stored in D0 and later,
and stored to the 3rd character (from the left end) and later for the character string data stored in D100 and later when
X010 turns ON.
  
S
1
   
D
  
S
2
   
D
  
S
2
  
S
1
  
S
2
  
S
2
59H(Y)
43H(C)
31H(1)
5AH(Z)
31H(1)
32H(2)
45H(E)
46H(F)
31H(1)
32H(2)
45H(E)
46H(F)
X010
D100
FNC207
MIDWP
D0
END
R0
D1
D2
D3
b15---------------b8b7-----------------b0
“21FE03”
D100
D101
b15---------------b8b7-----------------b0
33H(3)
30H(0)
53H(S)
55H(U)
“USCYZ10B”
R1
4
3
D102
D103
42H(B)
30H(0)
0000H
b15---------------b8b7-----------------b0
53H(S)
55H(U)
“US21FE0B”
0000H
42H(B)
30H(0)
D0
R0
D104
D100
D101
D102
D103
D104
The 1st to 4th characters are stored.
1st
character
1st
character
3rd
character
3rd
character
After execution
Before execution
4th
character
00H