Mitsubishi QD51 Programming Manual page 84

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

3 LET'S CREATE AND EXECUTE A PROGRAM
3 - 43
(5) Processes using full-byte characters
As shown in Section 3.13.1, one full-byte character (Kanji) uses the amount of
space required for two half-byte characters both for display and storage. For this
reason, the following consideration must be taken when handling a character
string containing full-byte characters in half-byte character increments.
1) When using a function that extracts a portion of a character string
The character length of a character string that contains full-byte characters is
as follows.
OK
PRINT LEN( "A B C
1 2 3 45 67 89 1011 12 13 14
14
OK
As shown in the example above, full-byte characters are counted as two
characters. When full-byte characters as contained in the character string in
which LEFT$, MID$, or RIGHT$ is to be used, full-byte characters must be
treated as two characters. The screen display will contain errors if one half of a
full-byte character is extracted.
Unidentifiable
characters are
displayed
2) When using functions that obtain character codes
The ASC function cannot be used to obtain the code numbers for full-byte
characters. To obtain the correct codes, use the JIS$ function (Section 3.13.3)
OK
PRINT HEX$(ASC( "@" ))
82
OK
PRINT JIS$ ( "@" )
2422
OK
@ @ @ @
D E F" )
OK
PRINT LE FT$ ("
A B C @ @ @ ‹ @D E F
1 2 3 4 5 6 7
ABC@@
OK
A B C @ @ @ ‹ @D E F
PRINT LEFT$("
1 2 3 4 5 6
ABC@
Is not displayed
OK
A B C @ @ @ ‹ @ D E F
PRINT RIGHT$("
d@ DEF
OK
The correct code for "@" is 2422h,
but the result is shown as 82h.
MELSEC-Q
The KLEN function is
used when full-byte
characters are to be
treated as one
character.
For details,
see Section 3.13.3.
" , 7)
Half of "@" is extracted
" , 6)
Half of "@" is extracted
" , 6)
6
5
4
3
2
1
The KMID$ is used to extract full-byte
characters properly.
For details, see Section 3.13.3.
3 - 43

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents