ACI [String to Integer]
Rockwell Software
Use the ACI instruction to convert an ASCII string to an integer value between -32768 and 32767. This instruction sets the arithmetic flags (bits 0-3 in the processor status file S:0).
Entering Parameters
Source is an ST (string) file that contains the string data to convert.
Destination is the address location where the converted integer value is stored.
Operation
1 The ACI rung is enabled.
2 The processor searches the source for the first character between 0-9. All numeric characters are extracted until a non-numeric character or the end of the string is reached. Action is taken only if the numeric characters are found. If the string contains an invalid length (<0 or >82) the ASCII Error bit S:5/15 is set. Commas and sign(+,-) are allowed in the string. However, only the minus sign is displayed in the data table.
3 The extracted numeric string is converted to an integer. The ASCII Error bit S:5/15 is set if a numeric overflow occurs or if the string contains an invalid string length.
Arithmetic Flags
S:0/0 - Carry bit (reserved)
S:0/1 - Overflow bit sets if the integer value is outside of the valid range.
S:0/2 - Zero bit sets if the integer value is zero.
S:0/3 - Sign bit sets if the result is negative