2 application programming – Rockwell Automation 57C442 Data Highway Plus Interface Module User Manual

Page 26

Advertising
background image

4-8

4.2.2

Application Programming

Read and write commands from the Data Highway Plus Interface
module are initiated from a BASIC application task by executing the
GATEWAY_CMD_OK@ function:

GATEWAY_CMD_OK@(status%, cmd_code%, slave_drop%,

&

slave_reg$, master_var!, num_regs%)

where:

status is an integer variable representing the location where the
status resulting from the operation is stored. Refer to Appendix E for
a list of status values.

cmd_code is a variable name or expression of type integer
representing the Data Highway Plus command sent by the module.
The commands are described in section 4.2.4. Any other commands
result in a status of 1 (invalid operation) being returned.

slave_drop is variable name or expression of type integer containing
the destination station number (in decimal or hexadecimal). This is
the station number on your Data Highway Plus network. In the case
where off-link addressing is used, this is the address of the bridge
node on the local Data Highway Plus network. See section 4.2.6 for
more information.

slave_reg is a variable name or expression of type string that
specifies the starting register number on the target device. For
commands 3, 4 and 5, this is a logical address represented as an
ASCII string for PLC-3 and PLC-5 controllers. It can also be a 5-digit
octal number. For commands 1 and 2, this argument should be an
octal number. This field can also contain Data Highway Plus routing
information. Refer to section 4.2.6. For command 5 (Read-Modify-
Write), this argument can contain up to ten addresses separated by
commas. The address must exist at the target station.

master_var is a variable name or expression (usually via the BASIC
language VARPTR! function) of type double integer, representing
the physical address of the starting register on the Data Highway
Plus module to be read from/written to.

num_regs is a variable name or expression of type integer that
defines:

for Word Range Read/Write (command 3 or 4), the number of
registers to be transferred, from 1 to 1000;

for Read-Modify-Write (command 5), the number of addresses
to be written, in the range 1 to 10;

for Unprotected Read/Write (command 1 or 2), the number of
registers to be transferred, from 1 to 100.

The GATEWAY_CMD_OK@ function will be true if the command was
successfullycompleted. If the function is false, the returned status will
be an error code. See Appendix E for the error codes returned by the
GATEWAY_CMD_OK@ function.

Advertising