10-8
ASCII Instructions
String to Integer (ACI)
ACI
ACI
String to Integer
Source
ST10:0
Dest
N7:75
0<
Fixed SLC
SLC
SLC
5/01
5/02
5/03
•
Output Instruction
Publication 1747-RM001G-EN-P - November 2008
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.
Use the ACI instruction to convert a numeric ASCII string to an integer value
between -32,768 and 32,767.
Example
SLC
SLC
5/04
5/05
•
•
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).
Table 10.6 Processor Function
With this Bit
S:0/0
Carry (C)
S:0/1
Overflow (V)
S:0/2
Zero (Z)
S:0/3
Sign (S)
The Processor
is reserved.
sets if the integer value is outside of the valid range.
sets if the integer value is zero.
sets if the result is negative.