Integer to ASCII Convert

Inputs/Outputs Operands Data Types
IN VW, IW, QW, MW, SW, SMW, LW, AIW, T, C, AC, Constant, *VD, *AC, *LD INT
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 Integer to ASCII instruction converts integer word (IN) to an ASCII string. The format (FMT) specifies the conversion precision to the right of the decimal, and whether the decimal point is to be shown as a comma or a period. The resulting conversion is placed in 8 consecutive bytes beginning with OUT. The ASCII string is always 8 characters.

Error Conditions that Set ENO = 0:

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


The format operand (FMT) for the ITA instruction is defined below. The size of the output buffer is always 8 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, 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.