Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 442

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

■Setting method of (s) for when SM705 (Number of conversion digits selection) is on
Set decimal ASCII data with a desired number of digits (including 00H (NULL code)) in (s). Note that 00H (NULL code) is not
required to be set if the integral part has the maximum number of digits (5 digits).
The following table lists the setting method of (s).
Value to be set in
Data of (s) to (s)+2
(s)
• 0
• Set 00H in the upper byte of (s).
• Positive value (1
• The data of (s)+1 or later is ignored.
digit in numeric
part)
(s)
(s)+1
(s)+2
• Negative value (4
• Set 00H in the upper byte of (s)+2.
digits in numeric
part)
(s)
(s)+1
(s)+2
• Negative value (5
• The data of (s)+3 or later is ignored. Since the
digits in numeric
part)
(s)
(s)+1
(s)+2
• The ASCII data in the device specified by (s) to (s)+2 is within the range from -32768 to 32767 for the DABIN(P) instruction,
and it is within the range from 0 to 65535 for the DABIN(P)_U instruction.
• Set 2DH (-) to lower byte of (s)+0 as sign data when the ASCII data is negative. Set an ASCII code of the uppermost digit
instead of setting sign data when the ASCII data is 0 or positive.
• A value from 30H to 39H can be set in each place of ASCII code.
• If the value is positive and the numeric part has 5 digits, the data of the upper byte of (s)+2 or later is ignored. If the value is
negative and the numeric part has 5 digits, the data of (s)+3 or later is ignored.
• If a value 20H is set in each place of ASCII code, the value is processed as 30H. If a value 00H is set, the value is
processed as the end of the decimal ASCII data.
• In the following cases, 0 is stored.
• The first character is 00H (NULL).
• The first character is 2DH (-) and the second character is 00H (NULL).
Operation error
Error code
Description
(SD0)
3401H
Invalid data that cannot be converted are input in (s) to (s)+2.
• The ASCII code of the first character is other than 2DH, 30H to 39H, 20H, and 00H.
• The ASCII code of the second character or later is other than 30H to 39H, 20H, and 00H.
• When the DABIN(P) instruction is used, ASCII data is out of the range from -32768 to 32767.
• When the DABIN(P)_U instruction is used, ASCII data is out of the range from 0 to 65535.
*1 When SM705 (Number of conversion digits selection) is off, no error is detected no matter what value is set for the ASCII code of the
first character.
6 BASIC INSTRUCTIONS
440
6.6 Data Conversion Instructions
b15
∙∙∙
b8
b7
00H
b15
∙∙∙
b8
b7
3
ASCII 10
1
ASCII 10
00H
number of digits is the maximum, 00H is not
required to be set.
b15
∙∙∙
b8
b7
4
ASCII 10
2
ASCII 10
0
ASCII 10
Value to be set in
(s)
• Positive value (2
digits in numeric
part)
∙∙∙
b0
• Negative value (1
0
ASCII 10
digit in numeric
part)
• Positive value (5
digits in numeric
∙∙∙
b0
part)
2DH (-)
2
ASCII 10
0
ASCII 10
0
ASCII 10
: Ones place of ASCII code
1
ASCII 10
: Tens place of ASCII code
4
ASCII 10
: Ten-thousands place of ASCII code
∙∙∙
b0
2DH (-)
3
ASCII 10
1
ASCII 10
Data of (s) to (s)+2
• Set 00H in the lower byte of (s)+1.
• The data of the upper byte of (s)+1 or later is
ignored.
b15
∙∙∙
b8
b7
0
(s)
ASCII 10
ASCII 10
(s)+1
(s)+2
• The data of the upper byte of (s)+2 or later is
ignored. Since the number of digits is the
maximum, 00H is not required to be set.
b15
∙∙∙
b8
b7
3
(s)
ASCII 10
1
(s)+1
ASCII 10
(s)+2
*1
∙∙∙
b0
1
/ 2DH (-)
00H
∙∙∙
b0
4
ASCII 10
2
ASCII 10
0
ASCII 10

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents