The text of a manual · part 8 of 15
Communication Adapter Module (cat. no. 1771-KA2) User's Manual, pages 71 to 80
Pages 71 to 80 of 144
The original document is the PDF (2.0 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-KA2
Page 71
Chapter 6 Status Words
Chapter Summary
This was the WORD and CODE chapter and it discussed: START/DONE, REMOTE/LOCAL FAULT bit storage REMOTE/LOCAL fault word Error code storage word (Error code list is in Appendix A.) Chapter 7 continues discussion about command initiation, control bits, fault words, and monitoring.
6-7
Page 72
Chapter 6 Status Words
6-8
Page 73
Chapter
7
Command Initiation, Execution, and Monitoring
General
This chapter describes the support programming for commands at each station processor. This programming uses the START/DONE and REMOTE/LOCAL FAULT bits, described in chapter 6, to initiate and monitor command execution. Using these recommended techniques, the programmer coordinates communication zone programming with his application program.
START/DONE Bit Timing
The START bit that initiates a command is program-controlled; the DONE bit, which indicates command completion, is communication adapter module-controlled. The timing relationship of START and DONE bits is used by the programmer to initiate and terminate commands. The following sections describe this relationship in normal operation and describe the automatic responses that result from faulted operation. Normal Operation Command execution begins when the user program turns a START bit ON, normally with a LATCH instruction. The 1771-KA2 communication adapter module detects the ON state of this bit and then begins the operations necessary to format and transmit a command message. When the remote station communication adapter module receives the command message, it acknowledges it. Then, while normal Data Highway operation continues, the remote station communication adapter module executes the command and prepares a reply message. (A reply message is sent for each type of command.) The remote station communication adapter module responds to a poll for mastership, then transmits its reply message to the local (sending) station. (Refer to chapter 8 for a description of mastership and polling.) When the local station communication adapter module receives the reply, it sets the done bit on at the local station processor. The DONE bit, in turn, is examined in the user program to turn OFF the START bit. After the START bit has been turned OFF (unlatched), the communication adapter module resets the DONE bit. 7-1
Page 74
Chapter 7 Command Initiation, Execution, and Monitoring
Figure 7.1 shows the timing of START and DONE bits for a command. The significance of START/DONE bit status is summarized in Table 7.A.
Figure 7.1 START/DONE Bit Timing - Normal Operation A
Done Bit
C
D
ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉ
On Start Bit
B
Off
Processor Scan
Command/ Response Time
On Off
Communication Adapter Scan
Legend: A
Start bit turned on by the program
B
Done bit set on by the 1771–KA2 communication adapter module to indicate that a command has been completed.
C
Start bit turned off by the program
D
Done bit set off by the 1771–KA2 communication adapter module after it senses that the start bit has been set off.
Table 7.A START/DONE Bit Status Status
7-2
Significance
Start Bit
Done Bit
0
0
Idle
1
0
Command initiated or in progress
1
1
Command/reply operation complete
0
1
The processor, based on the program, acknowledges completion of the command/reply operation (transient condition, since the communication adapter turns the DONE bit OFF in its next scan.)
Page 75
Chapter 7 Command Initiation, Execution, and Monitoring
Faulty Operation Certain fault conditions can prevent normal reception and execution of commands by the receiving station. To indicate the source of such fault conditions, the KA2 controls REMOTE and LOCAL FAULT bits at the station processor. In general, the LOCAL FAULT bit indicates that the local station cannot confirm delivery of a command to the remote station. The REMOTE FAULT bit, on the other hand, indicates that the intended receiving station communication adapter module has received the command message, but is unable to execute the command at its station processor. (For a quick summary of the distinction between these FAULT types, refer to Figure 6.3.) The timing relationship of these FAULT bits in command execution is shown in Figure 7.2. In this example, the command initiated at the setting of the START bit executed due to some fault condition. The communication adapter module, detecting this fault condition, sets either a LOCAL or REMOTE FAULT bit.
Figure 7.2 START/FAULT Bit Timing - Faulted Operation A
Start Bit
On Off
B
On Off
Done Bit
On Off
D
ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉÉ Command/ Response Time
Remote or Local Fault Bit
C
Legend:
A
Start bit turned on by the program
B
Remote fault or local bit set on by the communication adapter module to indicate that a fault condition has been detected.
C
Start bit turned off by program
D
Fault bit turned off by the communication adapter module after it senses that start bit has been turned off.
Communication Adapter Scan
7-3
Page 76
Chapter 7 Command Initiation, Execution, and Monitoring
Recall that the START bit is program-controlled. The REMOTE/LOCAL FAULT bits, meanwhile, are controlled by the 1771-KA2 module. The programmer must keep this relationship in mind when planning START bit control and FAULT bit monitoring in the ladder-diagram program. Note from Figure 7.2 that the FAULT bit, once ON, remains ON until the START bit is reset (turned OFF). Only after it has detected that the program-controlled START bit is OFF does the communication adapter module then turn the FAULT bit OFF. Note also that the DONE bit is not set ON in the event of a fault condition. NOTE: In the special case where the START bit is turned OFF by the program before the KA2 sets a DONE or FAULT bit, attempts to send that command are terminated. The LOCAL FAULT bit is pulsed ON for approximately 60 msec in this instance. This type of situation may occur, for example, if some event is programmed to UNLATCH the START bit before command completion. Controlling The Start Bit
The user program controls the START bit: setting it ON to initiate command execution, turning it OFF after command completion or after a fault is detected. Normally, the START bit is turned ON by a LATCH instruction, OFF by an UNLATCH instruction. The use of retentive LATCH/UNLATCH instructions is best suited for the timing relationship of START, DONE, and FAULT bits and helps to keep programming simple and straightforward. To LATCH the START bit, the program examines application conditions. These may include input/output device data, values, or other information from the controlled process. For the most part, an application condition used to initiate a command is one of these general types: The ON or OFF status of some I/O device Transition of some I/O device Timed condition To UNLATCH the START bit, the program examines the response from the communication adapter module. This response may be one of the following: DONE bit REMOTE FAULT bit LOCAL FAULT bit
7-4
Page 77
Chapter 7 Command Initiation, Execution, and Monitoring
Thus, the rung used to UNLATCH the START bit examines these three possible responses in parallel branches of the ladder diagram program. Section titled “ON/OFF Input Status,” “Transition,” and “Timed” describe the most commonly used forms of START bit control. Each section describes a different method for initiating command execution; all examples show how the program uses both DONE and FAULT bits to UNLATCH the START bit. An important assumption underlies the examples outlined in sections titled “ON/OFF Input Status,” “Transition,” and “Timed” and shown in Figures 7.3 through 7.5. Here, the program automatically re-tries transmission of a command in the event of a fault. Only the DONE bit terminates attempts at command execution; a LOCAL or REMOTE FAULT bit response causes the program to re-initiate command execution. (This type of programmed re-try is not to be confused with the re-try procedure of the 1771-KA2 module itself; transparent to user programming, the module automatically attempts several re-tries of a message before it sets a FAULT bit. Section titled “Floating Master,” in chapter 8, describes these automatic re-tries of the module.) Programmed re-try has distinct advantages. As the communication adapter module continuously tries to send the command message, any data content of the message (for a write command) is continuously updated. As soon as the fault condition is corrected, the message is sent, with the latest data. In addition, once the command is completed, the program automatically UNLATCHES the START bit. This eliminates the need for a manual reset of the START bit when a fault condition is corrected. ON/OFF Input Status The ON or OFF status of an input device can be used to LATCH the START bit. Figure 7.3 shows rungs for this type of command initiation.
7-5
Page 78
Chapter 7 Command Initiation, Execution, and Monitoring
Figure 7.3 Status-Initiated Command
Input 11111
Done 03202
Remote Fault 03312 /
Input 11111 /
Local Fault 03302 /
Start 032 12 L Start 032 12 U
Local Fault 03302 Remote Fault 03312
In this example, the first rung is programmed to LATCH the START bit when the input, bit 11111, is ON, provided that both FAULT bits are OFF. The second rung is programmed to UNLATCH the START bit based on the response of the communication adapter module. In normal operation, the START bit is LATCHED by the input 11111; the FAULT bits, initially, are OFF. This causes the command message to be formatted and sent. Then, when the command is completed, the DONE bit is set ON by the communication adapter module. Note that the input bit, 11111, must also be OFF to UNLATCH the START bit in this example. With this arrangement, the command message is sent only once; input 11111 must be turned OFF, then ON again, to execute this command a second time. In normal operation, the START bit, after successful command completion, remains ON until input 11111 goes OFF. (Recall from Figure 7.1 that the communication adapter module holds the DONE bit ON until after the START bit is turned OFF.) Should a fault condition prevent normal execution, these rungs provide a programmed re-try of the command. A REMOTE or LOCAL FAULT bit resets the START bit in the second rung. In the first rung, the START bit is LATCHED again after the communication adapter module resets the FAULT bit. (As Figure 7.2 shows, the 1771-KA2 module resets a FAULT bit only after the START bit has been turned OFF.) 7-6
Page 79
Chapter 7 Command Initiation, Execution, and Monitoring
Even though the FAULT bits are continually reset with this method, their usefulness must not be overlooked. The section titled “REMOTE/FAULT Bit Monitoring” outlines a useful method to monitor FAULT bits and control an output indicator based on FAULT bit status. In some applications, it may be useful to send a command continuously between stations. With the example of Figure 7.3, this can be accomplished by eliminating the EXAMINE OFF instruction for input 11111 in the second rung. This would cause the command to be sent continuously as long as input 11111 remains ON. Transition The transition of an input device from ON to OFF and from OFF to ON can be used to LATCH the START bit. This allows a command to be sent each time a condition changes state. Figure 7.4 shows example rungs for this type of command initiation.
7-7
Page 80
Chapter 7 Command Initiation, Execution, and Monitoring
Figure 7.4 Transition-Initiated Command
Input 11111
Compare 01111 /
Input 11111 /
Compare 01111
Rung 1
Input 11111
Transition 02000 L OFF
Compare 01111
Rung 2
Transi– tion 02000 Rung 3
Remote Local Fault Fault 03312 03302 / /
Start 03212 L OFF
Done 03202 Rung 4
Start 03212 U
Local Fault 03302
Remote Fault 03312
Done 03202 Rung 5
7-8
Transition 02000 U