Rockwell Automation 57C442 Data Highway Plus Interface Module User Manual

Page 36

Advertising
background image

4-18

Example 3: Command 5, Read-Modify-Write

In the example below, the Data Highway Plus Interface module writes
to three addresses in a PLC, N7:0, N7:2, and N7.4. The AND/OR mask
pairs are stored in three consecutive pairs of registers starting at
B3BASE%. The variable B3BASE% is defined in the rack configuration

10 COMMON B3BASE% \!

Represents the physical address of &
the starting register on the

&

Data Highway Plus module to be

&

read from

20 LOCAL DST%

\!

The address of the destination node &
on the local Data Highway Plus network

21 LOCAL STS%

\!

The location where the status

&

resulting from the operation is stored

22 LOCAL SZE%

\!

The number of registers to be

&

transferred

23 LOCAL CMD%

\!

The Data Highway Plus command &
sent by the module

30 DST% = 0
31 STS% = 0
32 SZE% = 3
33 CMD% = 5
40 IF NOT GATEWAY_CMD_OK@(STS%, CMD%, DST%,

&

“N7:O,N7:2,N7:4”, VARPTR!(B3BASE%), SZE%)

&

THEN 20000 \! process errors at line 20000

Example 4: Command 1, Unprotected Read

In the example below, the Data Highway Plus Interface module is
reading 100 words from address 2000 octal in the PLC at station
address 7. The data read is stored in the local 83 file; the variable
B3BASE% is defined in the rack configuration.

10 COMMON B3BASE% \!

Represents the physical address of &
the starting register on the

&

Data Highway Plus module to be

&

read from

20 LOCAL DST%

\!

The address of the destination node &
on the local Data Highway Plus network

21 LOCAL STS%

\!

The location where the status

&

resulting from the operation is stored

22 LOCAL SZE%

\!

The number of registers to be

&

transferred

23 LOCAL CMD%

\!

The Data Highway Plus command

&

sent by the module

30 DST% = 7
31 STS% = 0
32 SZE% = 100
33 CMD% = 1
40 IF NOT GATEWAY_CMD_OK@(STS%, CMD%, DST%, “2000”,&

VARPTR! (B3BASE%), SZE%) THEN 20000 \! process errors &
at line 20000

Advertising