Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
26 Applied Instructions (Character String Control)
26.4 LEN / Character String Length Detection
632
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
Function and operation explanation
1. 16-bit operation (LEN/LENP)
The length of a character string stored in the device specified by and later is detected, and stored to the
device specified by . Data starting from the device specified by until the first device storing "00H" is
handled as a character string in units of byte.
For example, when "ABCDEFGHI" is stored in the device specified by and later as shown below, K9 is
stored in the device specified by .
Caution
1) This instruction can handle character codes other than ASCII codes, but the character string length 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".
Errors
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 the detected number of characters is "32768" or more. (Error code: K6706)
+1
+2
2nd
character
1st
character
4th
character
3rd
character
00H
b15 ------------------
Character string length
+n
6th
character
5th
character
"n"th
character
It indicates the end of character string.
+0
LEN
EN ENO
d
s
Head device storing a character
string whose number of characters
is to be detected
Command
input
Device storing the detected character
string length (number of bytes)
s
d
b15---b8 b7---- b0
b0
+1
+2
42H(B) 41H(A)
44H(D) 43H(C)
48H(H)
9
+4
46H(F) 45H(E)
47H(G)
"ABCDEFGHI"
00H 49H(I)
+3
+0
s
d
b15 -------------- b0
b15---b8 b7---- b0