Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 192

Advertising
background image

Publication 1746-RM001A-US-P

13-2 Input Functions

CALL 22 – Transfer Data
from Port 1 or 2 to the
CPU Files

Purpose

Use CALL 22 to transfer data from the module serial ports directly to the CPU
input data file, CPU M1 file and/or an internal string within the module. During
data transfer, data is automatically transferred in 8-bit blocks from the input buffer
of the selected port to the selected SLC processor buffer and/or BASIC internal
string for storage. The transfer occurs when the specified number of characters are
detected in the input buffer of the port or the user-defined delimiter is received in
the port. The data is stored either low byte first, then high byte, or high byte first,
then low byte within the 16-bit word of the destination. Data is transferred on
word boundaries. If an odd number of bytes are to be transferred, the unused byte
contains a zero.

The byte swap selection (low byte first, then high byte, or high byte first, then low
byte) of the last CALL 22 or CALL 23 executed determines the data packing
method for all ports enabled by CALL 22.

The low byte of the first word of the destination file contains the character count
(byte count) of the data being transferred. If a delimiter is found, the byte count is
expanded to include the first occurrence of the delimiter. The second word of the
destination file contains the first two characters of data.

If an internal string is chosen, the first character of the string contains the byte
count. The second character of the internal string is a transaction number and is
incremented to inform the module that new data is in the string. The value of this
character wraps around from 255 to 0. The third character of the string contains
the first data character.

Execute CALL 22 to set up the data transfer parameters. After the CALL is
executed, the module gets data from the port and transfers it to the destination file.
Input and output image file bits (word 0, bits 8 and 9) for the slot containing the
module, are used to initiate and notify completion of the transfer. The operation is
described below:

1.

1.

1.

1. When data is available from the port, the module automatically transfers the

data into the destination buffer. This same port is checked for data at the end
of each line of BASIC code.

SLC Processor

SLC Backplane

BASIC or BASIC-T Module

External Device

RS-232, RS-422, or

RS-485 Network

DESTINATION

BUFFER

PORT PRT1

PORT PRT2

Advertising