Rockwell Automation AutoMax ControlNet Communication Interface Module User Manual
Page 44
![background image](/manuals/581117/44/background.png)
Page 44 AutoMax ControlNet Module
Publication number DSMBCN-UM001B-EN-P February 2003
Application Programming
Read and write commands from the MBCN are initiated from a BASIC
application task by executing the GATEWAY_CMD_OK@ function:
GATEWAY_CMD_OK@(status%, cmd_code%, slave_node%, &
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 page 51 for a list of
status values.
• cmd_code is a variable name or expression of type integer
representing the PCCC command sent by the module. The
commands are described on page 46.
Any other commands result in a status of 1 (invalid operation) being
returned.
slave_node is variable name or expression of type integer containing the
destination address (in decimal or hexadecimal). This is the address on
your network.
slave_reg is a variable name or expression of type string that specifies
the starting register number an the target device. For commands 3, 4, 5,
6, and 7, this is a logical address represented as an ASCII string for
PLC-5 controllers. For commands 1 and 2, this argument contains 4
octal digits, for example, "0200" (word offset). For command 5 (Read-
Modify-Write), this argument can contain up to ten ASCII addresses
separated by commas. The address must exist at the target node.
master_var is a variable name or expression (usually via the BASIC
language
The VARPTR! Function, of type double integer, represents the physical
address of the starting register on the 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) or for Typed
Read/Write (commands 6 or 7), 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 returns true if the command was
successfully completed. If the function returns false, the returned status is
an error code. Refer to page 51 for the error codes returned by the
GATEWAY_CMD_OK@ function.
Multiple tasks can access the MBCN.