Sample api module, Typed read – Rockwell Automation 1785-Vx0B, D17856.5.9 PLC-5 VME VMEbus Programmable Controllers User Manual User Manual

Page 79

Advertising
background image

Chapter 6

PLC-5/VME Processor
Communications Commands

6-10

Sample API Module

For a sample
interface
header file:

Refer to page:

For a sample
implementation
source file:

Refer to page:

P40VRMW.H

B-75

P40VRMW.C

B-76

This command lets the host CPU read file data from the PLC-5/VME
processor one packet at a time, starting at a specified address plus offset.
Your driver program must:

re-issue the command for each packet the number of times required to

complete the total transaction.

manipulate the offset field to get the data for each packet.

The PLC-5/VME processor:

automatically checks that the size and total transaction values do not

exceed the number of words in the data file.

returns the specified data type as an array.

This read-block command contains a data-type ID. The host CPU places
the data-type code in the write-block command packet. The PLC-5/VME
processor places the data-type code in the reply packet of a read-block
command. The type of data received in a read-block command must match
the file type receiving the data. The driver program of the host CPU must
convert data types when necessary.

See the “Header Bit/Byte Descriptions” section on page 6-4 for
descriptions of all bytes except the following:

Use the:

To:

PLC-5/VME processor
ADDR field

specify the first element of file data to be read. If the total transaction
requires more than one packet, keep this address constant and
manipulate the OFFSET value.

OFFSET field (2 byte,
low byte first)

point to the starting element of each packet when the total transaction
requires more than one packet. The offset specifies the number of
elements above the base address (PLC-5/VME processor ADDR). Set
the offset to zero for the first packet and manipulate its value for each
successive packet. The PLC-5/VME processor does not check overlaps
or spaces between packets.

TOTAL TRANSaction
field (2 bytes, low byte
first)

specify the number of data elements (excluding ID bytes) of the total
transaction. By specifying the total transaction in the first of multiple
packets, the PLC-5/VME processor can generate an error code if the
total transaction value will exceed the end boundary of the specified file.

SIZE field (2 bytes, low
byte first)

specify the number of DATA elements the PLC-5/VME processor must
return in each reply packet. The PLC-5/VME processor automatically
returns an array of data in response to a read-block command.

Typed Read

Advertising