Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 11 of 31

DF1 Protocol and Command Set Reference Manual: 6 - Application Layer Message Packets

Pages 80 to 87 of 251, from DF1 Protocol and Command Set Reference Manual

The original document is the PDF (2.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

Filed in the catalog under the Allen-Bradley 5250-LP and Allen-Bradley 5250-MLP1

Page 80

Chapter

6

Application Layer Message Packets Read this chapter to help learn about the application layer for your asynchronous driver and the fields that your computer uses in the application layer of a message packet. It contains these sections: Section

Page

How Your Application Program Sends and Receives Messages

6-2

Message Packet Format

6-3

Publication 1770-6.5.16 - October 1996

Page 81

6–2

Application Layer Message Packets

How Your Application Program Sends and Receives Messages

There are two types of application programs: • command initiators • command executors This application program

Sends command initiator command messages - specify which command function to execute at a particular remote node Each command message requires one reply message. The command initiator must check for error codes and, depending on the type of error, retransmit the message or notify the user. The command initiator should also use a timer to be aware of lost reply messages (due to noise or other factors). If the time limit expires before the initiator receives the reply, the initiator can retransmit or notify the user.

command executor reply messages - responsible for interpreting and executing the command message. The executor must issue a reply message for each command it receives. If the executor cannot execute a command, it must send the appropriate error code.

Internally, Allen-Bradley asynchronous interface modules use a routing subroutine and a message queue. When the module receives a message over its asynchronous link, it puts the message in its queue. The routing subroutine then takes the message from the queue and transmits it over the DH, DH+, or DH485 network. The module also queues messages received from the network. The routing subroutine takes these messages and retransmits them over the asynchronous link. If this layer

Cannot deliver a command message application reply message data-link

Publication 1770-6.5.16 - October 1996 message over the asynchronous link

It should generate a reply message with the appropriate error code and send the reply to the initiator. destroy the reply without notification to the command executor. return an error message to the command initiator.

Page 82

Application Layer Message Packets

Message Packet Format

6–3

Most devices send and receive messages using this message packet format: Command

DST

SRC CMD

STS

Command-specific data packet

TNS

FNC Reply read write

SRC DST

CMD

STS

TNS

SRC DST

CMD

STS

TNS

ADDR

SIZE DATA

Command-specific data packet

The bytes are shown from left to right in the order they are transmitted across the link.

Field

Contents

See

DST SRC FNC CMD destination node for the message source node of the message function code command code

ADDR address of memory location (2 bytes)

page 6-8

STS EXT STS status code extended status code page 6-6

SIZE number of bytes to be transferred page 6-8

TNS transaction number (2 bytes)

page 6-7

DATA data values being transferred by the message The number of data bytes in a message depends on the command or function being executed.

Chapter 7 page 6-4 page 6-5

The combination of SRC, CMD, and TNS bytes uniquely identifies every message packet. One of these fields in the current message must be different than the corresponding field in the last message received by a command executor. If all fields are the same, the message is ignored and is considered to be a duplicate. If the receiving module has the “ignore duplicate messages” option enabled, the message will be ignored.

Publication 1770-6.5.16 - October 1996

Page 83

6–4

Application Layer Message Packets

DST and SRC Form the DST and SRC bytes of a reply message by interchanging the DST and SRC bytes of the corresponding command message: Command

Reply

Byte DST (destination) SRC (source)

DST

SRC

SRC

DST

Contents

Value supplied by

Value range receiving message application layer sending message data link layer

•0 to 376 (octal) for DF1 •0 to 376 (octal) for DH •0 to 77 (octal) for DH+ •0 to 31 (decimal ) for DH485

When sending messages from asynchronous devices, special consideration must be given to the SRC byte: When sending a message from an asynchronous device connected

Set the SRC byte to the network➀

= 0 (the module will set the byte to its own node number)

directly to a 1771-KG

10 (octal)

➀

Publication 1770-6.5.16 - October 1996

If you connect to channel 0 of a PLC-5/11, -5/20, -5/30, -5/40, -5/60 or -5/80 processor and you send a PLC-2 unprotected write, protected write, protected bit write, or unprotected bit write, what you put into the SRC byte is very important. This determines the compatibility file. This means that the value of the SRC byte specifies the data table file number that is written to the PLC-5 processor. The source byte will not be overwritten by channel 0. For SLC 500 processors, the compatibility file is always 9.

Page 84

Application Layer Message Packets

6–5

CMD and FNC These bytes work together to define the activity that is to be performed by the command message at the destination node. Values for these bytes are supplied by the application layer. The message format depends on the CMD and FNC values. CMD byte Bit:

7

6

5

4

3 2

0

Command or Reply

Priority

0

Command always = 0 command message = 0 reply message = 1 always = 0

1 0 command code normal priority = 0 high priority= 1➀

➀ High priority only applies to DH links. It does not apply to DH+, DH485, or DHII links.

This byte CMD (command) FNC (function)

Defines the

And has these values command type specific function under that command type see table that begins on page 7-2

Example code PLC-2 command enter download mode send = 00000111 (07 hex) reply = 01000111 (47 hex) high-priority send (DH only) = 00100111 27 hex high-priority reply (DH only) = 01100111 (67 hex)

Publication 1770-6.5.16 - October 1996

Page 85

6–6

Application Layer Message Packets

STS and EXT STS These bytes work together to indicate the status of the message transmission. This byte STS (status)

Four high bits of STS byte all = 1 (F0 hex)?

Yes

EXT STS byte

Has this value command

The application program sets = 0. = 0 when the command has executed with no error. = one of the status codes listed in Chapter 8, Packet Status Codes (STS, EXT STS)." This byte will also 0 if an error occurs.

reply

EXT STS➀ (extended status) ➀

In this message reply

EXT STS is part of the message only if STS = F0.

STS byte 7 6

5 4

3 2

1 0

No no EXT STS byte

Application layer uses these bits (and in some cases the EXT STS byte), to report remote errors errors that occur when the command executor at the destination node tries to execute the command message).

"

Link layer uses these bits to report local errors errors that occur when the link layer attempts to transmit a message across the link.

STS and EXT STS error codes For more information on STS and EXT STS error codes, see Chapter 8, “Message Packet Status Codes (STS, EXT STS).”

Publication 1770-6.5.16 - October 1996

Page 86

Application Layer Message Packets

6–7

TNS The TNS (transaction) bytes contain a unique 16-bit transaction identifier. Generate this number by maintaining a 16-bit counter. Increment the counter each time your command initiator (application program) creates a new message, and store the counter value in the two TNS bytes of the new message. In a multi-tasking environment, you must use only one TNS counter, and the procedure to read and increment the TNS must be indivisible.

command reply

TNS

Command executor copies the TNS field of the command message into the TNS field of the corresponding reply message.

TNS

Command initiator checks TNS value of reply and matches it to one of its command messages. The low byte (least significant bits) of the TNS value is transmitted before the high byte (most significant bits).

For command messages transmitted by

Values are assigned by a PLC the interface module assigns the TNS values.

computer node your application level software. The software must assign a unique 16-bit transaction number.

Important:

Do not change the TNS value in a reply message. If you change this value, the command initiator cannot match its command to the corresponding reply message.

Publication 1770-6.5.16 - October 1996

Page 87

6–8

Application Layer Message Packets

ADDR The ADDR (address) bytes contain the byte address of a memory location in the command executor where the command is to begin executing, except in SLC 500 processors, where the ADDR byte is interpreted as the word address. In SLC 5/02, SLC 5/03, and SLC 5/04 processors, the CIF Addressing Mode bit, S:2/8, can be set to a one to change the interpretation of the ADDR byte to the byte address, so that it is compatible with other PLC processors. For example, if the command is to read data from the command executor, ADDR specifies the address of the first byte of data to be read. ADDR contains the low (least significant) byte of the address

" contains the high byte of the address

Sending commands to PLC-3, PLC-5, and SLC 500 processors In some instances, when sending commands from the basic command set to a PLC-3, PLC-5, or PLC-5/250 processor, or to an SLC 500 processor, you must create special files to accept the data.

Important:

The ADDR field specifies a byte address, not a word address as in PLC data tables. Chapter 13, “PLC Addressing,” explains how to convert PLC word addresses to byte addresses. Also, if you use the “native” read and write commands in PLC-3, PLC-5, or SLC 500 processors, the address is not a byte address; it is a logical binary, logical ASCII, or SLC address with multiple address fields.

SIZE The SIZE byte specifies the number of data bytes to be transferred by a message. This field appears in read commands, where it specifies the number of data bytes that the responding node must return in its reply message. The SIZE varies with the type of command. For PLC-5 and PLC-5/250 typed read and typed write commands, the SIZE field specifies the number of elements, not bytes. In PLC-5 typed read and typed write commands, the SIZE field is two bytes long, transmit low byte first and high byte second.

Publication 1770-6.5.16 - October 1996