beautypg.com

Using explicit messaging (pcp communications) 6-17, Figure 6.3 lad5 - pcp read subroutine (continued) – Rockwell Automation 20-COMM-I Interbus Adapter User Manual

Page 79

background image

Using Explicit Messaging (PCP Communications)

6-17

Figure 6.3 LAD5 - PCP Read Subroutine (Continued)

Copy the PCP Read Command message to the scanner for transmission on the network.

0004

B3:47

1

PCP Read
Routine
1-shot

COP

Copy File
Source

#N22:10

Dest

#M0:1.0

Length

4

COP

The PCP Read Command 1-shot is used so the subroutine processes and sends the Command only once when called by the
MAIN PGM

0005

L

B3:47

1

PCP Read
Routine
1-shot

When the scanner acknowledges the PCP Read command, turn the Command word PCP Read bit OFF (originally comes from
N22:10 which was COPied to M0: above).

0006

M1:1.0

2

Status
PCP Read

U

M0:1.0

2

Command
PCP Read

When the scanner Status word indicates that a message is available, copy the message for processing and handshake with the
scanner by turning the Command word Message Acknowledge bit ON.

0007

M1:1.0

15

Status
Message
Present

B3:47

2

PCP Read
Reply Msg
1-Shot

COP

Copy File
Source

#M1:1.0

Dest

#N22:20

Length

8

COP

PCP Read
Reply Msg
Status Word

L

M0:1.0

15

Command
Message
Acknowledge

If the Reply contains only 1 byte of data, then the high and low bytes need to be swapped (e.g. a value of "5" will be stored as a
"0005" as opposed to "0500".

0008

M1:1.0

15

Status
Message
Present

B3:47

2

PCP Read
Reply Msg
1-Shot

EQU

Equal
Source A

N22:25

2<
Source B

1

1<

EQU

PCP Read
Reply Msg
# Bytes of Data

SWP

Swap
Source

#N22:26

Length

1

SWP

PCP Read
Reply Msg
Data Word #1

If the Reply does not contain 4 bytes of data, then the parameter is not 32-bit and Data Word #2 needs to be zero'd (might
contain leftover data from a previous 4-byte PCP Read).

0009

M1:1.0

15

Status
Message
Present

B3:47

2

PCP Read
Reply Msg
1-Shot

NEQ

Not Equal
Source A

N22:25

2<
Source B

4

4<

PCP Read
Reply Msg
# Bytes of Data

MOV

Move
Source

0

0<
Dest

N22:27

0<

MOV

PCP Read
Reply Msg
Data Word #2

20COMM-UM007A-EN-P.book Page 17 Tuesday, January 22, 2002 10:52 AM