Download Print this page

Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual page 321

Instructions, standard functions/function blocks
Hide thumbs Also See for MELSEC iQ-F FX5:

Advertisement

• The total number of digits stored in (d1) is the total number of characters (including the sign and decimal point) representing
the numeric value. The number of digits in the decimal part stored in (d1)+1 is the number of characters representing the
decimal part after 2EH (.). The 16-bit binary data stored in (d2) is binary value converted from a character string with the
decimal point ignored.
b15
∙∙∙
b8
b7
(s)
ASCII 1
(s)+1
ASCII 3
(s)+2
ASCII 5
(s)+3
ASCII 7
(s)+4
Indicates the end of character string.
Ex.
When the character string "-123.45" (signed) is specified by (s) and later
b15
∙∙∙
b8
b7
(s)
31H (1)
(s)+1
33H (3)
34H (4)
(s)+2
(s)+3
00H
• The total number of characters of the character string specified by (s) is 2 to 8 characters.
• In the character string specified by (s), the number of characters that form the decimal part is 0 to 5 characters. However,
be sure to specify "Total number of digits - 3" or below.
• The range of the character string of the numeric value that can be converted to a binary value is -32768 to +32767 for a
signed value with the decimal point ignored, and 0 to 65535 for an unsigned value. A character string of a numeric value
excluding the sign and decimal point can be specified only within the range of 30H to 39H. (Value with the decimal point
ignored ... "-12345.6" becomes "-123456".)
• When representing a positive numeric value, 20H is set in the sign, and when representing a negative numeric value, 2DH
is set.
• 2EH is set in the decimal point.
• When "20H (space)" or "30H (0)" exists between the sign and the first non-zero number in a character string specified by
(s), "20H" or "30H" is ignored during conversion to a binary value.
Ex.
When "20H" exists between the sign and the first non-zero number (a signed value is specified)
Total number of digits
Number of digits of the decimal part
-
1 2 3 . 4 5
BIN16
Ignore
Ex.
When "30H" exists between the sign and the first non-zero number
Total number of digits
Number of digits of the decimal part
0 . 0 0 1 2
BIN16
Sign
Ignore
Precautions
• Store signed data, "space (20H)" or "- (2DH)" only in the 1st byte (low-order 8 bits of the head device set in (s)). Only the
ASCII data "0 (30H)" to "9 (39H)", "space (20H)" and "decimal point (2EH)" can be stored from the 2nd byte to the "00H" at
the end of the character string in (s). If "- (2DH)" is stored in the 2nd byte or later, an operation error occurs.
∙∙∙
b0
ASCII S
ASCII 2
ASCII 4
-
ASCII 6
00H
Sign
2nd character
1st character
∙∙∙
b0
2DH (-)
32H (2)
2EH (.)
- 1 2 3
35H (5)
8
2
-
1 2 3
7
4
12
(d1)
Total number of digits
Number of digits of
(d1)+1
the decimal part
Integer value in which the
(d2)
.
decimal point is ignored
∙∙∙
7th character
BIN16
(d1)
7
(d1)+1
2
(d2)
- 1 2 3 4 5
.
4 5
4 5
7.5 Data Conversion Instructions
7 BASIC INSTRUCTIONS
319
7

Hide quick links:

Advertisement

loading