EasyManua.ls Logo

Mitsubishi Electric MELSEC FX Series - Page 655

Mitsubishi Electric MELSEC FX Series
838 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
7 Applied Instructions
7.20 Character String Control
653
FXCPU Structured Programming Manual
(Basic & Applied Instruction)
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied
Instructions
8
Interrupt Function
and Pulse Catch
Function
A
Relationships
between devices
and addresses
Cautions
1) When handling character string data in a structured program, a 16-bit device cannot be specified directly
as in the case of a simple project. Use a label to handle character string data.
Use a global label to specify a device.
2) 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]
VAR_02:=LEFT(X010,VAR_01,D0);
X010
LEFT
EN ENO
d
s
n
*1. VAR_01 is a global label and is defined as D100.
VAR_01
*1
VAR_02
*2
D0
*2. VAR_02 is a global label and is defined as R10.
[Structured ladder]
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

Table of Contents

Other manuals for Mitsubishi Electric MELSEC FX Series

Related product manuals