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 23

Bulletin 1771 Communication Controller Module (Cat. Nos. 1771-KE, -KF) User's Manual, pages 101 to 110

Pages 101 to 110 of 228

The original document is the PDF (9.6 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.

For the Allen-Bradley 1771-KE

Page 101 read from a scan by OCR; it may hold reading errors

Page 5-3 Message Packet Formats

5.3

Message Packet

If your network layer software cannot deliver a command message, it should generate a reply message with an error code in it and send that reply to the command initiator. If it cannot deliver a reply message, the network layer software should simply destroy the reply without notification to the command executor.

If your link layer software cannot deliver a message over the RS-232-C link, it also should return an error message to the command initiator.

The message bytes contain unsigned binary data from both the application layer and the network layer. Figure 5.2 shows the general format of a command message. Network layer fields are shaded. The meanings of the bytes are:

e DST, destination station for the message e SRC, source station of the message e CMD, command code e STS, status code e TNS, transaction e RNG, rung number for PC command message e SQN, sequence number of message e FNC, function code e ADDR, address of memory location e DATA, data values being transferred by the message

These bytes are described in more detail below. Not all command messages have FNC, ADDR, or DATA bytes.

DST

SRC

Legend: x= low hex digit of CMD byte supplied by application layer

From Application Layer

Network Layer Packet

11329

Figure 5.2, Command Message Packet Format

Page 102 read from a scan by OCR; it may hold reading errors

Page 5-4 Message Packet Formats

Figure 5.3 shows the general format of a reply message. Network layer fields are shaded. The definitions of these bytes are the same as for command messages. Not all reply messages have DATA bytes.

CMD x

From STS DATA Application Layer

DST SRC

Network Layer Packet

Legend: x = low hex digit of CMD byte supplied by application layer.

11330

Figure 5.3 - - Reply Message Packet Format

5.3.1 DST and SRC

5.3.2 CMD and FNC

Note that the bytes are shown from left to right in the order in which they are transmitted across the link.

The DST (destination) byte contains the station number of the station that is the ultimate destination of the message. The SRC (source) byte is the station number of the station that originated the message.

The network layer supplies the DST and SRC values. Allowed values for these bytes are 0 to 254 decimal.

Note that you can form the DST and SRC bytes of a reply message simply by interchanging the DST and SRC bytes of the corresponding command message.

The CMD (command) and FNC (function) bytes together define the activity to be performed by the command message at the destination station. CMD defines the command type and FNC, if used, defines the specific function under that command type.

Appendix A lists all the available CMD and FNC codes in hexadecimal notation. The exact format for a particular message depends on the CMD and FNC values. Section 5.3 explains the use of each command or function and gives a detailed description of the message text format for each.

Figure 5.4 shows the format for the CMD byte itself. Bits 0 through 4 contain the command code. Bits 4 and 7 should always be set to 0. Bit 5 is the priority indicator; set it to 0 for normal priority messages and 1 for high priority messages

Page 103 read from a scan by OCR; it may hold reading errors

Page 5-5 Message Packet Formats

5.3.3 STS

5.3.4 TNS

(chapter 2). Bit 6 is the command/reply indicator; set it to 0 in a command message and 1 in a reply message.

Note that reply messages also contain a CMD byte. To form the CMD value for a reply, the network layer copies the CMD value from the corresponding command message and sets the reply bit (bit 6) to 1.

Bit 7 6© 5 4 3 2 1 0

0 r p 0 command

11702

Figure 5.4, CMD Byte Format

The application layer supplies the FNC value and the command code (bits 0 to 3) of the CMD byte for each command message. The network layer supplies bits 4 through 7 of the CMD byte.

The STS (status) byte indicates the status of the message transmission. In command messages, the application program should always set the STS value to 0. In reply messages, the STS byte may contain one of the status codes listed in chapter 7, Note that an STS value of 0 in a reply message means “no error.”

In a reply message, the STS byte is divided between application layer and network layer. The network layer uses bits 0 through 3 of the STS byte to report local errors (those errors that occur when the network layer attempts to transmit a message across the link). The application layer uses bits 4 through 7 of the STS byte to report remote errors (those errors that occur when the command executor at the destination station tries to execute the command message). Chapter 7 explains local and remote error codes.

The TNS (transaction) bytes contain a unique 16-bit transaction identifier. A complete transaction consists of a command message transmitted by a PC station. RNG contains the number of the PC program rung that generated the command, and SQN contains the transmission sequence number. For command messages transmitted by your computer station, your application programs can use the RNG and SQN

Page 104 read from a scan by OCR; it may hold reading errors

Page 5-6 Message Packet Formats

5.3.5 ADDR bytes together to store a single 16-bit transaction number.

For command messages transmitted by a PC station, the station interface module assigns the TNS values. For each command message transmitted by your computer station, your network level software must assign a unique 16-bit transaction number and a simple way to generate this number is to maintain a 16-bit counter at the network layer. Increment the counter every time your command initiator (application program) creates a new message, and store the counter value in the two TNS bytes of the new message.

When the command initiator receives a reply to one of its command messages, it can use the RNG and SQN bytes to tie the reply message to its corresponding command. If the RNG and SQN bytes of a reply message match the RNG and SQN bytes of a command message, then that reply is the appropriate one for that command.

Whenever your command executor receives a command from another station, it should copy the RNG and SQN fields of the command message into the same fields of the corresponding reply message. Do not change the RNG and SQN values in a reply message. If you do, the command initiator will not be able to match its command to the corresponding reply message.

Note that the low byte (least significant bits) of your TNS value will be transmitted across the link before the high byte (most significant bits).

At any instant, the combination of SRC, CMD, RNG, and SQN are sufficient to uniquely identify every message packet in transit. At least 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 none of these fields is different, the command executor ignores the currently received message. This process is called duplicate message detection.

The ADDR (address) field is a 2-byte field that contains the address of a memory location in the command executor. ADDR specifies the address where the command is to begin executing. 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.

The first byte of the ADDR field contains the low (least significant) byte of the address, and the second byte of ADDR contains the high byte of the address. Chapter 6 gives more details on the contents of the ADDR field.

Note that the ADDR field specifies a byte address, not a word address as in PC programming. Chapter 6 explains how to convert PC word addresses to byte addresses.

Page 105 read from a scan by OCR; it may hold reading errors

Page 5-7 Message Packet Formats

5.3.6 SIZE

5.3.7 DATA

5.4 Message Formats

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 station must return in its reply message. The allowed value for SIZE will vary with the type of command, as indicated in the reply formats below.

The DATA field contains binary data from the application program. The number of data bytes in a message depends on the command or function being executed, as indicated in section 5.3. Chapter 6 gives some details on the format for the data field.

This section presents the detailed message formats for each type of command and reply message. For this presentation, the command message formats are discussed in the following order:

use this command | use this function If you want this command: code: code:

Basic command set

Diagnostic counters reset 06 07 Diagnostic loop 06 00 Diagnostic read 06 01 Diagnostic status 06 03 Protected bit write 02 N/A Protected write 00 N/A Set ENQs 06 06 Set NAKs 06 05 Set timeout 06 04 Set variables 06 02 Unprotected bit write 05 N/A Unprotected read 01 N/A Unprotected write 08 N/A

PLC commands

Disable outputs 07 00 Enable program 07 01 Enable scan 07 03 Physical read 04 N/A

Physical write 03 N/A

Page 106 read from a scan by OCR; it may hold reading errors

Page 5-8 Message Packet Formats

If you want this command:

use this command code:

use this function code:

PLC-2 commands

Enter download mode 07 04 Enter upload mode 07 06 Exit download/upload mode 07 05 Physical read 04 N/A Physical write 03 N/A Set data table size 06 08 PLC-3 commands

Bit writes OF 02 Download request OF 05 File read OF 04 File write OF 03 Physical read OF 09 Physical write OF 08 Restart request OF OA Shutdown request OF 07 Upload request OF 06 Word range read OF 01 Word range write OF 00 PLC-4 commands

Allocate OE 05 Deallocate OE 06 Initialize processor OE oc Physical read OE oD Physical write OE 0E Physical write with mask OE OF Set to program mode OE 01 Set to run mode OE 02 Set to single step test mode OE 04 Set to test mode OE 03

Page 107 read from a scan by OCR; it may hold reading errors

Page 5-9 Message Packet Formats

5.4.1 Basic Command Set

Basic commands include those that can generally be executed by any PC station on the communication link, regardless of the type of PC controller at that station. In some cases, switch settings on the station interface module can disable execution of a particular type of command at that station. For more details, Refer to the user’s manual for the station interface module.

Basic commands are in two categories:

Privileged Commands @

Diagnostic counters reset Diagnostic loop Diagnostic read Diagnostic status

Set ENQs

Set NAKs

Set timeout

Set variables

Non-privileged Commands

Protected bit write Protected write Unprotected bit write Unprotected read Unprotected write i computer initiates commands and PCs execute commands

EXComputer and PC stations can initiate commands; only PCs can execute commands (unless the computer is programmed for execution).

Page 108 read from a scan by OCR; it may hold reading errors

Page 5-10 Message Packet Formats

5.4.1.1 Diagnostic Counters Reset

5.4.1.2 Diagnostic Loop

5.4.1.3 Diagnostic Read

This command resets to zero all the diagnostic timers and counters in the station interface module. The diagnostic status command gives the starting address for this block of counters and timers.

Command Format:

You can use this command to check the integrity of transmissions over the communication link. The command message transmits up to 243 bytes of data to a station interface module. The receiving module should reply to this command by transmitting the same data back to the originating station.

Command Format:

AN \ A ¥v

FNC | DATA, Max of 243 bytes \, - DATA, Max of 243 bytes

This command reads up to 244 bytes of data from the PROM or RAM of the station interface module. You can use it to read the module’s diagnostic timers and counters. Use the diagnostic status command to obtain the starting address of the diagnostic counters.

Command Format:

Tq FNC | ADDR | SIZE 01

Reply Format:

mn \

¥

‘ DATA, Max of 244 bytes » EER

Page 109 read from a scan by OCR; it may hold reading errors

Page 5-11 Message Packet Formats

5.4.1.4 Diagnostic Status

This command reads a block of status information from the station interface module. The reply to this command contains the status information in its DATA field.

Command Format:

AN \ DATA, Max of 244 bytes

\

The status information varies with the type of station interface module. Table 5.A describes the contents of the status DATA field for 1771-KA, 1771-KC/KD, 1771-KE/KF, 1771-KG, and 1774-KA modules. Table 5.B lists the status DATA for 1773-KA module. Table 5.C describes this DATA for 1775-KA modules.

Table 5.A

Contents of Status DATA for 1771-KA, 1771-KC/KD, 1771-KE/KF, 1771-KG, and 1774-KA Modules

Byte Meaning

1 Operating status of PC processor:

Bits 0 to 2: 0 = Program load mode 1= Test mode 2= Run mode

(not used)

Remote program load

5 = Remote test

6 = Remote run monitor (PLC) Bit 3: O= Normal

1= No communication with PC Bit 4: 0= Normal

1= Download mode Bit 5: 0O= Normal

1 = Format error in communication zone of PC program Bits 6 and 7: Always zero 2 Type of station interface module and processor:

Bits 0 to 3: = 1771-KC/KD module

1= 1771-KA module also KA2 2= 1774-KA module = 1771-KE/KF module = 1771-KG module = (not used) = 1775-KA, data highway port = 1775-KA, RS-232-C port 8 = 1771-KA, data highway port = 1773-KA, RS-232-C port

(continued)

Page 110 read from a scan by OCR; it may hold reading errors

Page 5-12 Message Packet Formats

Table 5.A Continued

Contents of Status DATA for 1771-KA, 1771-KC/KD, 1771-KE/KF, 1771-KG, and 1774-KA Modules

Byte } Meaning

Bits 4 to 7: Q= PLC processor 1 = PLC-2 processor 2= PLC-2/20 (L.P1) processor 3 = Mini-PLC-2 processor 4= PLC-3 processor 5 = PLC-2/20 (LP2) processor 6 = PLC-2/15 processor 7 = PLC-2/30 processor 8 = PLC-4 Microtrol processor 15 =Computer

3,4 Octal word address of the start of PC program 5.6 Memory size (number of bytes) for PLC processors; zero otherwise

7,8 Starting byte address of diagnostic counters and timers

9 Series and revision level of station interface module: Bits 0 to 4: O= Revision A 1 = Revision B etc. Bits 5 to 7: O= Series A 1= Series B etc.

(KA2 series B, revision A)

10 Settings of the option switches on the station interface module. This byte is not used in replies by 1771-KC/KD or 1771-KE/KF modules. For the other modules, the bits of this byte are defined as follows:

1771-KA Module

= 56,700 bits per second = 76,800 bits per second = 38,400 bits per second = 115,200 bits per second

= All other PLC-2 Family processors = PLC-2 processor

Bits 0 to 1:

Bit 2:

Bit 3: = Protected commands enabled

= Protected commands disabled

Bit 4: 0 = Unprotected commands enabled 1 = Unprotected commands disabled

Bit 5: Not used

Bit 6: Q= Physical writes enabled 1 = Physical writes disabled

Bit 7: 0= Transmission of unprotected commands enabled

1= Transmission of unprotected commands disabled

(continued)