Mitsubishi Electronics FX3G User Manual

Page of 964
158
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
5 How to Specify Devices and Constants to Instructions
5.3 Character Strings
5.3
Character Strings
Character strings are classified into character string constants which directly specify character strings in operands in
applied instructions and character string data.
5.3.1
Character string constant ("ABC")
A device "character string" directly specifies a character string in a sequence program.
Put half-width characters inside quotation marks (example: "ABCD1234") in specification.
JIS8 code is available.
Up to 32 characters can be specified as a character string.
5.3.2
Character string data
With regard to character string data, a specified device to the NULL code (00H) is handled as one character string in
1-byte units.
When expressing (recognizing) character string data by bit devices with digit specification, however, 16 bits are
required for data including the NULL code (00H) specifying the end of the character string data because the instruction
length is 16 bits.  (Refer to Example 2 in the step 2 below.)
In the following cases, an operation error occurs in the applied instruction (error code: K6706):
• When "00H" is not specified in the corresponding device range after the source device number specified in an 
applied instruction
• When there are insufficient devices for storing character string data (including "00H" or "0000H" indicating the end 
of the character string data) in the destination devices specified in an applied instruction
1) Character string data stored in word devices
• Example of data which can be
• Example of data which cannot be 
   recognized as character string data
   recognized as character string data
2) Character string data stored in bit devices with digit specification
• Example of data which can be
• Examples of data which cannot be
   recognized as character string data
   recognized as character string data
2nd character
4th character
6th character
00H
1st character
3rd character
5th character
21st character
"00H" indicating the end of
the character string can be
detected.
b15                 b8 b7                   b0
D100
D101
D102
D110
2nd character
4th character
6th character
"n"th character
1st character
3rd character
5th character
"(n-1)"th character
"00H" indicating the end of character string
cannot be detected from the specified
device to the end device number.
b15                 b8 b7                     b0
D100
D101
D102
D7999
2nd character
4th character
6th character
00H
1st character
3rd character
5th character
13th character
"00H" indicating the
end of the character
string can be
detected.
16 bits
M115 to M100
M131 to M116
M147 to M132
M211 to M196
2nd character
4th character
6th character
"n"th character
1st character
3rd character
5th character
"(n-1)"th character
"00H" indicating the end of character string
cannot be detected from the specified
device to the end device number.
<Example 1>
16 bits
M115 to M100
M131 to M116
M147 to M132
M7679 to
M7664
2nd character
4th character
6th character
8th character
1st character
3rd character
5th character
00H
Because the data "00H" indicating the end
of the character string does not reach 16
bits, the end of the character string cannot
be recognized.
<Example 2>
16 bits
M7623 to M7608
M7639 to M7624
M7655 to M7640
M7671 to M7656
M7679 to M7672
7th character