Double Integer to ASCII Convert

Inputs/Outputs Operands Data Types
IN VD, ID, QD, MD, SD, SMD, LD, HC, Constant, AC, *VD, *AC, *LD DINT
FMT VB, IB, QB, MB, SMB, LB, AC, Constant, *VD, *AC, SB, *LD BYTE
OUT VB, IB, QB, MB, SMB, LB, *VD, *AC, SB, *LD BYTE

Memory Ranges ENO Errors Instruction Support for S7-200 CPUs SIMATIC/International Mnemonics
The Double Integer to ASCII instruction converts a double word (IN) to an ASCII string. The format (FMT) specifies the conversion precision to the right of the decimal. The resulting conversion is placed in 12 consecutive bytes beginning with OUT.

Error Conditions that Set ENO = 0:

0006 (indirect address), SM4.3 (run-time), no output (illegal format)


The format operand (FMT) for the DTA instruction is defined below. The size of the output buffer is always 12 bytes. The number of digits to the right of the decimal point in the output buffer is specified be the nnn field. The valid range of the nnn field is 0 to 5. Specifying 0 digits to the right of the decimal point causes the value to be displayed without a decimal point. For values of nnn bigger than 5, a conversion error is generated and the output buffer is filled with ASCII spaces. The c bit specifies the use of either a comma (c=1) or a decimal point (c=0) as the separator between the whole number and the fraction. The upper 4 bits must be zero.

The output buffer is formatted in accord with the following rules:

1.Positive values are written to the output buffer without the sign.

2.Negative values are written to the output buffer with a leading minus sign (-).

3.Leading zeros to the left of the decimal point (except the digit adjacent to the decimal point) are suppressed.

4.Values are right-justified in the output buffer.