Publication 1747-RM001G-EN-P - November 2008
10-8 ASCII Instructions
The Error bit (ER) is set during the execution of the instruction if:
• the instruction is aborted - serial port not in User mode.
• the instruction is aborted due to channel mode change.
• the Unload bit (UL) is set and the instruction is not executed.
String to Integer (ACI)
Use the ACI instruction to convert a numeric ASCII string to an integer value
between -32,768 and 32,767.
Example
The processor searches the source (file type ST) for the first character between
0 and 9. All numeric characters are extracted until a non-numeric character or
the end of the string is reached. Action is taken only if 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 signs (+, -) are allowed in the string. However, only
the minus sign is displayed in the data table.
The extracted numeric string is then converted to an integer. The ASCII Error
bit S:5/15 is set if the string contains an invalid string length. The value of
32,767 is returned as the result.
This instruction also sets the arithmetic flags (found in word 0, bits 0-3 in the
processor status file S:0).
ACI
String to Integer
Source ST10:0
Dest N7:75
0<
ACI
Output Instruction
Fixed SLC
5/01
SLC
5/02
SLC
5/03
SLC
5/04
SLC
5/05
•••
Table 10.6 Processor Function
With this Bit The Processor
S:0/0 Carry (C) is reserved.
S:0/1 Overflow (V) sets if the integer value is outside of the valid range.
S:0/2 Zero (Z) sets if the integer value is zero.
S:0/3 Sign (S) sets if the result is negative.