Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
26 Applied Instructions (Character String Control)
26.6 LEFT / Extracting Character String Data from the Left
639
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
21
Applied Instructions
(Real Time
Clock Control)
22
Applied Instructions
(External Device)
23
Applied Instructions
(Extension
Function)
24
Applied Instructions
(Others)
25
Applied Instructions
(Block Data
Operation)
26
Applied Instructions
(Character
String Control)
27
Applied Instructions
(Data Operation 3)
28
Applied Instructions
(Data Comparison)
29
Applied Instructions
(Data Table
Operation)
30
Applied Instructions
(External Device
Communication)
Cautions
1) When handling character codes other than ASCII codes, note the following contents:
a) The number of characters is handled in byte units (8 bits). Accordingly, in the case of character codes
in which two bytes express one character such as shift JIS codes, the length of one character is
detected as "2".
b) When extracting characters from a character string including character codes in which two bytes
express one character such as shift JIS codes, consider the number of characters to be extracted in
units of character codes for one character.
Note that the expected character code is not given if only one byte is extracted out of a 2-byte
character code.
Error
An operation error is caused in the following cases. The error flag M8067 turns ON, and the error code is
stored in D8067.
1) When "00H" is not set within the corresponding device range after a device specified by .
(Error code: K6706)
2) When "n" exceeds the number of characters specified by . (Error code: K6706)
3) 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)
4) When "n" is a negative value. (Error code: K6706)
Program examples
In the program example shown below, the number of characters which is equivalent to the number stored in
D0 is 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.
[ST]
LEFT(X010,D100,D0,R10);
X010
LEFT
EN ENO
d
s
n
D100
R10
D0
[Structured ladder/FBD]
51H(Q) 53H(S)
4EH(N) 4FH(O)
44H(D) 48H(H)
51H(Q) 53H(S)
4EH(N) 4FH(O)
48H(H)44H(D)
ASCII code for 6th character
42H(B) 41H(A)
"SQONHDAB"
0000H
"SQONHD"
D100 R10
D0
6
ASCII code for 1st character
00H
D101
D102
D103
D104
R11
R12
R13
b15 b8 b7 b0
b15 b8 b7 b0