beautypg.com

4 number conversion 7-147 – HEIDENHAIN TNC 407 (243 020) Technical Manual User Manual

Page 608

background image


01.98

TNC 407/TNC 415/TNC 425

4 PLC Modules

7-147

4.4 Number Conversion

4.4.1 Number Conversion Binary to ASCII (Module 9050)

Converts a binary numerical value consisting of mantissa and exponent to the base 10 to an ASCII-
coded decimal number.

The number specified as mantissa and exponent is converted to a decimal number and stored at the
specified address as a string. The exponent relates to the lowest-value place in the number. A
negative number is detected when the mantissa corresponds to a negative number in the notation
as a two's complement. A sign is only set in front of negative numbers. Trailing zeroes after the
decimal point or leading zeroes before the decimal point are not converted, the string is written left-
justified starting from the specified target address in the string buffer.

Constraints:
- The decimal sign is defined by machine parameter MP7280 as a decimal comma (MP7280 = 0) or

a decimal point (MP7280 = 1).

Possible errors:
- The number of the target string is outside the permitted range (0..3).
- The conversion would result in more than 10 places after the decimal point.
- The conversion would result in more than 10 places before the decimal point.

Call:

PS

K/B/W/D

PS

K/B/W/D

PS

K/B/W/D

CM

9050

Error status after call: M3171 =

0: Number was converted
1: Error condition see above

Examples:

Mantissa

Exponent

Decimal number

123

0

"123"

-123

0

"-123"

123

2

"12300"

123

-3

"0.123"

123456

-3

"123.456"

123

-5

"0.00123"

100

-3

"0.1"

1234567890

-11

"0.0123456789"

123

-11

Error: more than 10 places after decimal
point

123456789

1

"1234567890"

123

8

Error: more than 10 places before decimal
point