7 BASIC INSTRUCTIONS
7.5 Data Conversion Instructions
319
7
• 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.
Ex.
When the character string "-123.45" (signed) is specified by (s) and later
• 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)
Ex.
When "30H" exists between the sign and the first non-zero number
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.
(s)
(s)+1
(s)+2
(s)+3
(s)+4
b15
b0
∙∙∙
∙∙∙
b7
b8
(d1)
(d1)+1
.
00H
(d2)
-
ASCII 1
ASCII 3
ASCII 5
ASCII S
ASCII 2
ASCII 4
ASCII 7
ASCII 6
Total number of digits
BIN16
Sign
1st character
2nd character
7th character
Indicates the end of character string.
∙∙∙
Integer value in which the
decimal point is ignored
Number of digits of
the decimal part
(s)
(s)+1
(s)+2
(s)+3
b15
b0
∙∙∙
∙∙∙
b7
b8
(d1)
(d1)+1
.
(d2)
7
2
- 1 2 3 4 5
- 1 2 3
4 5
31H (1)
33H (3)
34H (4)
2DH (-)
32H (2)
2EH (.)
00H
35H (5)
1 2 3 . 4 5
-
1 2 3
8
2
4 5
-
Total number of digits
Number of digits of the decimal part
BIN16
Ignore
0 . 0 0 1 2
7
4
12
Total number of digits
Number of digits of the decimal part
BIN16
Ignore
Sign
Содержание MELSEC iQ-F FX5
Страница 1: ...MELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks ...
Страница 2: ......
Страница 17: ...15 CONTENTS ...
Страница 24: ...22 MEMO ...
Страница 25: ...23 PART 1 PART 1 OVERVIEW Part 1 consists of the following chapter 1 OVERVIEW 2 PRECAUTIONS ON PROGRAMMING ...
Страница 126: ...124 6 SEQUENCE INSTRUCTIONS 6 3 Output Instructions Operation error There is no operation error ...
Страница 132: ...130 6 SEQUENCE INSTRUCTIONS 6 3 Output Instructions Operation error There is no operation error ...
Страница 140: ...138 6 SEQUENCE INSTRUCTIONS 6 3 Output Instructions Operation error There is no operation error ...
Страница 191: ...7 BASIC INSTRUCTIONS 7 2 Arithmetic Operation Instructions 189 7 Operation error There is no operation error ...
Страница 202: ...200 7 BASIC INSTRUCTIONS 7 2 Arithmetic Operation Instructions Operation error There is no operation error ...
Страница 278: ...276 7 BASIC INSTRUCTIONS 7 4 Bit Processing Instructions Operation error There is no operation error ...
Страница 280: ...278 7 BASIC INSTRUCTIONS 7 4 Bit Processing Instructions Operation error There is no operation error ...
Страница 915: ...18 TYPE CONVERSION FUNCTIONS 18 13 Converting DWORD to WORD 913 18 Operation error There is no operation error ...
Страница 917: ...18 TYPE CONVERSION FUNCTIONS 18 14 Converting DWORD to INT 915 18 Operation error There is no operation error ...
Страница 932: ...930 18 TYPE CONVERSION FUNCTIONS 18 26 Converting DINT to WORD Operation error There is no operation error ...
Страница 1050: ...1048 26 TIME DATA FUNCTIONS 26 4 Division MEMO ...
Страница 1068: ...1066 29 COUNTER FUNCTION BLOCKS 29 4 Counter Function Block Operation error There is no error ...
Страница 1107: ...I 1105 MEMO ...
Страница 1111: ......