January 2012 8.41 PLC Modules 1755
8.41.2 Number conversion
Module 9050 Conversion from binary → ASCII
Module 9050 converts a binary numerical value consisting of a mantissa and
exponent to base 10 into an ASCII-coded decimal number and saves it as a
string in the specified address. The exponent refers to the least significant
place of the number. The control detects a negative number when the
mantissa corresponds to a negative number in the notation as a two’s
complement. The control sets an algebraic sign only before negative numbers.
The control does not convert trailing zeros after the decimal point or leading
zeros before the decimal point. The control writes the string left-aligned in the
string address that you specify.
Constraints:
The decimal character is defined by Machine Parameter MP7280 as a comma
(MP7280 = 0) or a period (MP7280 = 1).
Call:
PS B/W/D/K <Mantissa of the number to be converted>
PS B/W/D/K <Exponent to base 10 of the value>
PS B/W/D/K <String address in which the control saves the ASCII-coded
decimal number>
CM 9050
Error recognition:
Marker Value Meaning
NN_GenApiModule
Error (M4203)
0 Number was converted
1 For error code see
NN_GenApiModuleErrorCode (W1022)
NN_GenApiModule
ErrorCode (W1022)
2 Invalid string address or invalid exponent