Installation manual

Publication 1747-RM001G-EN-P - November 2008
ASCII Instructions 10-15
ASCII Read Characters
(ARD)
Use the ARD instruction to read characters from the buffer and store them in
a string. To repeat the operation, the rung must go from false-to-true.
Entering Parameters
Enter the following parameters when programming this instruction.
Channel is the number of the RS-232 port (Channel 0).
Destination is the string element where you want the characters stored.
Control is the address of the control block used to store data for the
ARD instruction.
String Length (.LEN) is the number of characters you want to read
from the buffer. The maximum is 82 characters. If you specify a length
larger than 82, only the first 82 characters will be read. (A 0 defaults to
82.) This is word 1 in the control block.
Characters Read (.POS) are the number of characters that the
processor moved from the buffer to the string (0 to 82). This field is
updated during the execution of the instruction and is display only. This
is word 2 in the control block.
Error displays the hexadecimal error code that indicates why the ER bit
was set in the control data file (R6). See page 10-24 for error code
descriptions.
Example
When the rung goes from false-to-true, the Enable bit (EN) is set. When the
instruction is placed in the ASCII queue, the Queue bit (EU) is set. The
Running bit (IN) is set when the instruction is executing. The DN bit is set
upon completion of the instruction.
Once the requested number of characters are in the buffer, the characters are
moved to the destination string. The number of characters moved is put in the
POS field of the control block. The number in the Characters Read field is
continuously updated and the Done bit (DN) is not set until all of the
characters are read.
When the program scans the instruction and finds the Done bit (DN) set, the
processor then sets the Synchronous Done bit (EM). The EM bit acts as a
secondary done bit corresponding to the program scan.
EN
DN
ER
ARD
ASCII Read
Channel 0
Dest ST10:7
Control R6:5
String Length 20<
Characters Read 0
Error 0
ARD
Output Instruction
Fixed SLC
5/01
SLC
5/02
SLC
5/03
SLC
5/04
SLC
5/05
•••