7 programming example s – Rockwell Automation 57C442 Data Highway Plus Interface Module User Manual

Page 34

Advertising
background image

4-16

The Destination and Source Link ID’s and Node Addresses come from
the network configuration. The values for LSAP, Network Control Byte,
Lifetime and NSAP are constants. The twelve parameter values, in the
order shown are used with the AutoMax GATEWAY_CMD_OK@
function to program the AutoMax. They are the same for either writing
(CMD%=4) and reading (CMD%=3) data across the network.

An example of the GATEWAY_CMD_OK@ function is a basic task
which is used to either read or write to Integer file N7 in the PLCS/C
is:

NNNN

IF NOT GATEWAY_CMD_OK@

(STS%, CMD%, DST%” !01,24,07,00,01,00,80,05,00,07,00.00,N7:00”,

VARPTR! (N7BASE%),SZE%) THEN XXXX

Parameters STS%, CMD%, DST%, SZE% and N7BASE% are
discussed in the manual and are defined as LOCAL variables in the
basic task. NNNN is the line number for the function and XXXX is a line
number in the task where code to process errors is located.

4.2.7 Programming Example

s

This section contains examples of initiating commands by using the
GATEWAY_CMD_OK@ function within an AutoMax task. In the
following examples, each register is defined in the configuration for the
rack as follows. For example,

B3BASE%[SLOT=4, REGISTER=64]
N7BASE%[SLOT=4, REGISTER=4384]

The statements above are used in the following examples. The
VARPTR! function is used to return a double integer value for the
address of the specified argument.

Byte

Value

Function

1

01h

LSAP

2

24h

Network Control Byte

3

07h

Dest. Link ID - Lo

4

00h

Dest. Link ID - Hi

5

01h

Dest. Node Address - Lo

6

00h

Dest. Node Address - Hi

7

80h

Lifetime

8

05h

Source Link ID – Lo

9

00h

Source Link ID - Hi

10

07h

Source Node Address - Lo

11

00h

Source Node Address - Hi

12

00h

NSAP

Advertising