Home
1771-6.5.8, PLC-2 Family/RS-232
Contents
1. Figure 5 10 Processor aT j E 3 e s C d PLC D o 29 o f g d D 5 C li La Local 2 Station EE Remote Fault Possible Source e Remote Station Processor in Program Load or PROG Mode e Command Not Executed Due to Module Switch Setting at Remote Station e Fault at Remote Station Processor Power Off at Remote Station Processor Error Detected in Communication Zone of Program at Remote Station Processor Local Fault Possible Sources e Power off at Remote Station Interface Module e Unused Remote Station No Addressed e Station Interface Module at Local or Remote Station Has Disconnected Itself as a Result of Link Monitoring e Automatic Timeout at Local Station Remote 11316 Chapter 5 PC Programming Immediately before it sets a remote or local fault bit ON the communication adapter module enters a four digit error code into the error code storage word The error code storage word is described in the next section By monitoring fault bits in the program operator personnel can be alerted to hardware conditions which prevent normal transmission and execution of commands Programming techniques for monitoring fault bits are described in Command Initiation and Monitoring Error Word When t
2. 15 Pin Male 25 Pin Female Connector Connector i RS 232 C on 1770 CG Cable 16 5 Ft RS 232 C A mnn ecten PORT Connector able PORT Connector g of 1771 KG of Computer Module Ho H RS 232 C PORT RS 232 C PORT Connector of Connector of 1771 KG Module Computer 1 1770 CG Cable 16 5 Ft M i EI 3 g e 2 gt 3 BB ee uj e e ES 3 B 2 BA B Wiring Diagram e e 6 Poi 20 CD 8 e 8 CF 11 gt 6 CC 13 wu 11 4 4 CA 5 5 CB p 15 Pin Male 25 Pin Male Connector Connector 11309 The cable length is 16 5 feet 5 m If you need a longer cable or a male female adapter cable refer to the wiring diagram Figure 4 10 B to assemble your own cable Connect the shield at one end only Do not exceed the RS 232 C limit of 50 cable feet Chapter 4 Installation This connection configuration provides the data terminal ready signal to allow each end to detect the loss of the other end s ability to communicate To Modem To provide an RS 232 C communication link with a MODEM connect a 1770 CP cable between the RS 232 C PORT connector on the 1771 KG module and the connector for the RS 232 C compatible port of the MODEM Figure 4 11 Figure 4 11 Connection to a MODEM 15 Pin Male Connector 25 Pin Male Connector RS 232 C EY RS 232 C 1770 CP Ca
3. ADDR First Byte Second Byte 00100000 000000000 Low Byte Value 20 Hex High Byte Value 00 Hex NOTE PLC 2 family controllers use this same logical addressing format when they transmit command messages to another station If you plan to transmit a command message to your computer from one of these PCs you should set up a buffer space in your computer to simulate PC memory You would then have to write computer application programs to accept and execute commands from the PC stations and to translate the ADDR value into the corresponding address in the simulated PC memory C 9 Appendix C Data Manipulation C 10 Physical Addressing Physical addressing is the type of addressing a computer would use to send a physical read write command to a PC station In particular you would use physical addressing to upload or download PC memory The recommended procedure for doing this is to use a series of physical read or write commands that begin at Physical Address 0000 and proceed sequentially to the end of PC memory PLC 2 family controllers use physical addresses that are directly related to logical addresses To convert a given logical address to its corresponding physical address move Bit 7 of the logical address to Bit Position 1 and shift Bits 1 through 6 to the left one position Figure C 7 shows the conversion process for Logical Word Address 121 Remember that the logical PLC 2 address is a byte address so the phy
4. eee eee C 1 Generale oput quie hei PURI IR IHE See aquis que C 1 Data Encoding z dcos ird Sede ipi hacedeherese Rees C4 AOMIGSSING og rd 2a pbxrexuusticedasc pe REPRE RE C 9 Detailed Flowcharts Leeee D 1 G netal i2 xo spa bae Khaw edade ct d cade uA D 1 UART Shanng 332p PEeRREPRISuRRPEREPP sone ee dd ox D 1 SLEEP and WAKEUP 2 c ctued acces E eee ames Gace oo D 17 POWER UP 3a cshecoamediuniet lt Pate pri eee tno e D 1 Introduction General The PLC 2 Family RS 232 C Interface Module Cat No 1771 KG performs an interface function between a PLC 2 Family processor and an intelligent RS 232 C compatible device to provide Direct peer to peer or master slave communication with a computer or other programmable intelligent device such as the Advisor M Color Graphic System Direct peer to peer communication with an Allen Bradley communication module that provides a complementary interface function for another PC processor Interface with a Communication Controller Module Cat No 1771 KE KF for peer to peer communication with other stations on an Allen Bradley Data Highway Document Organization This manual describes installation operation and programming necessary to use the 1771 KG module This chapter provides a general description and lists specifications Subsequent chapters are organized as follows Chapter 2 outlines various network configurations and application cons
5. Set the BUFFER Flag RETURN RETURN 11683 D 25 Appendix D Detailed Flowcharts D 26 Figure D 32 GETFREE Subroutine GETFREE An Implementation Dependent Routine to Try to Allocate an Empty Message Buffer RETURN 11684 A ADDR Field 6 48 Addressing 6 65 C 9 Answering MODEM 4 21 Application Message Formats 6 50 Application Considerations 2 1 Application Layer 6 46 Application Message Fields 6 46 Binary C 2 Binary Coded Decimal C 3 Bit Command Format 5 10 Bit Write Access 5 36 Block Check Character BCC 3 7 6 5 Block Command Format 5 8 C Cabling 4 10 CMD High Nibble 6 44 CMD and FNC 6 46 Command Code 5 8 Command Initiation and Monitoring 5 18 Command Priority 5 38 Command Rungs 5 6 Command Structures 3 3 Command Reply Cycle 3 2 Communication Concepts 3 1 Communication Links 3 1 Communication Modules 2 1 Communication Protocol 6 1 Communication Rate 4 2 Communication Zone 5 1 Compatible Processors 1 2 Computer Programming 2 4 6 1 Configuration Selection 2 7 Connections 1 2 Control of PC Programs 5 17 Controlling the Start Bit 5 21 Index Cyclic Redundancy Check CRC 3 7 6 6 D Data Encoding _C 1 DATA Field Application Layer 6 49 Data Highway Link 2 4 Data Highway Network 2 2 Data Manipulation C 1 Data Security 3 6 Decimal C 4 Definition of Link and Protoco
6. DLE ENQ STN BCC DLE STX xxx DLE EXTBCC Same Message c XXXX DLE ACK gt OK 11571 6 37 Chapter 6 Communication Protocol Figure 6 22 shows slave unable to receive the acknowledgment from the master after the master successfully received the message from the slave Sometime later when the master polls that same slave again the slave sends the same message again The master responds with DLE ACK but discards the received transmission block because it detects it to be a duplicate message received from the slave With multiple slaves to implement this duplicate message detection the master must do either of the following Polla station repeatedly without polling any other station until it receives a DLE EOT to be sure it has detected any retransmissions feach station is polled only once per cycle the master must keep a record of the first six link level data bytes of the last transmission from each station since other stations may transfer messages between retransmissions from a given station Figure 6 22 Duplicate Message Transmission SOURCE SOURCE SINK MASTER LINK SLAVE SINK Not Full gt DLE ENQ STN BCC x00 XXXX DLE STX xxxx DLE EXTBCC c XXXX DL CK Sometime Later Not Full gt DLE ENQ STN BCC 7 DLE STX xxxx DLE EXTBCC
7. 00 15 12 Rung 4 Local Remote Fault Fault 033 033 035 ct TOF 02 12 0 1 PR 050 Rung 5 AC 000 Done Transition 032 020 Jut U 02 00 Remote Local Fault Bit Monitoring 11550 When it cannot execute a command the module sets a remote or local faits ON These bits in the data table of the local station processor are lopated in the word immediately following the start done WrendtioT hey indicat 4ot only that a command was not executed but also poi f to the general type of fault condition which prevented command coripletion 5 27 Chapter 5 PC Programming 5 28 The user program must monitor the remote and local fault bits for each command The recommendations of this section describe two methods for monitoring fault bits and using these bits to signal a fault condition Diagnostic Fault Rungs The purpose of remote local fault bit monitoring is to control one or more output indicators to signal a fault condition Fault indicators controlled for this purpose may be as simple as an annunciator or as complex as a printer or CRT terminal used to display a fault message By controlling the fault indicator device the user program can alert personnel to the nature and location of a fault condition In order to monitor the remote and local fault bits the programmer must understand their timing relationship to the corresponding start bit Figure 5 13 summarizes this relationship Controlling the Start Bit sho
8. ON ON Timeout setting too large Valid timeout settings are 011 to 407 A setting of 010 disables the timeout Bad address in command rung Bad size in read write command Communication problem on link between 1771 KG module and proces Sor Processor turned OFF the start bit before the module set the done bit Transmission timed out because the local station did not receive a valid reply to its command Frequent occurrence of this error might indicate that the timeout period is too short A minimum timeout of 2 seconds is recommended Local processor entered the program mode Processor fault occurred at local station while module was processing a reply message Reply message contains invalid value in low byte of TNS field No communication zone in PC program Module received a reply message for which the start bit is OFF This error occurs if the processor turns off the start bit or if the timeout period is too short This error often occurs after Error 35 or 37 Reply message received when module PROG indicator was ON or when processor was in program mode Reply message contains an invalid value in the high byte of the TNS field This error occurs if the start bit is turned off and back on before the done bit is turned on Reply message is of incorrect size Invalid command due to error in CMD byte FNC byte SIZE byte or overall size of command message Processor fault or disconnection at remote station
9. This format uses examine elements which address bits in the remote station These elements control remote station data table bits as follows EXAMINE ON This rung element instructs the remote station to turn the address bit ON EXAMINE OFF This rung element instructs the remote station to turn the addressed bit OFF These elements are programmed immediately following the command code Any combination of these elements may make up this type of command rung Where necessary branch start instructions and a branch end instruction may be used to fit these elements into the display area of the programming terminal For practical reasons do not exceed this display area Multiple rungs of this type can be used as necessary 5 10 Status Words Chapter 5 PC Programming The module controls certain data table words specified by the programmer in the local station processor These data table words indicate the status of command execution and provide various types of diagnostic information for start up and troubleshooting These words are One or More Pairs of Adjacent Words for Start Done and Remote Local Fault Storage An Error Word Refer to Figure 5 8 You specify the locations of these status words when entering the communication zone rungs A pair of start done and remote local fault words is defined by the selection of the start bit in a command rung You specify the error code storage word in the header ru
10. ccc cece eee eee eens 4 9 Cabling o genee od nee saa Dn wes beta Ud oua eiui 4 10 RS 232 C Port uso Eu aua SP vEREW LEUR cade Geese 4 20 ANSWOMNG und ed De ee en hada va idis 4 21 PC Programming 2eseaeu hahaha 5 1 General era E eae he ees OR te eee ee 5 1 Communication Zone n 22x rp ER ERE 5 1 Status WONS ante cee cue oo naana 5 11 Command Initiation and Monitoring seule 5 18 Memory Access Limitations 0c e eee eeeee 5 36 Table of Contents Communication Protocol 6 1 GONGIall ps iso an nee Eoo e X ac abd a edhe eie eas 6 1 Definition of Link and Protocol 00 0 cece eeaee 6 1 Full Duplex Protocol 0 0 00 cc cece cee eens 6 2 Half Duplex Protocol 0 0 ccc cece ence een eee 6 23 Network Layer 00 ccc ccc ce eee RI IIR 6 41 Application Layer 0 0 ccc BI 6 4 Upload Download Procedures Series B Modules 6 62 Start Up and Troubleshooting 7 1 Generals ee es ree ere TA Troubleshooting Aids 00 cece eee eee E Start Up Procedures 0 0 00 cece eee eee eens 7 1 Troubleshooting 0 00 cece cence eens 7 2 Error Reporting 24 sassxes sach ns hn nn A 1 Genetal uie xoa xr ule ava eve daca akan RN A 1 Eror Word e A 2 SII EFI A 2 Diagnostic Counters 00e eee e eee eee B 1 CCP X UIT B 1 Data Manipulation
11. 30 Number of DLE EOTs sent 31 Number of calls received 32 Number of times that phone was hung up by the 1771 KG module 33 Number of times that DCD was lost 34 Number of times that the phone was hung up because of a DCD timeout 35 Number of messages routed to RS 232 port 36 Number of commands routed to command executor 37 Number of replies routed to reply processor 38 Number of messages sent to self 39 Number of routing errors on inbound messages 40 Number of routing errors on outbound messages 41 Number of messages with incorrect network address 42 16 bit count of messages sent by command initiator 44 16 bit count of commands received by command executor 46 16 bit count of replies sent by command executor 48 16 bit count of replies received by command initiator 50 Number of breaks sent to industrial terminal 51 Number of resyncs sent to PC B 2 General Data Encoding Appendix Data Manipulation This appendix explains two areas of special concern when you are transmitting messages between computers and PCs Data Encoding Addressing Formats The information contained in this appendix gives some application details that relate to the data and address fields of the message formats In general PCs store binary data 1s and Os in 16 bit groups called words If you are looking at this data from a computer however you may interpret it in a number of different ways depending on your application needs
12. DLE ACK Discard Retransmission OK gt 11572 Chapter 6 Communication Protocol When a slave station fails to respond to a message from the master you should poll the slave to see if it is there If it answers the poll with a DLE EOT but consistently fails to ACK the master s message the slave s message sink is probably full If the slave answers with DLE EOT to a poll you should wait for the slave s receive buffers to clear This situation is to clear This situation is illustrated in Figure 6 23 Figure 6 23 Message Sink Full Case 1 SOURCE SOURCE SINK MASTER LINK SLAVE SINK XXXX gt DLE SOH STN DLE STXxxxx DLE ETX BCC gt Full Timeout Not Full gt DLE ENQ STN BCC No Message a DLE EOT Sometime Later DLE SOH STN DLE STXxxxx DLE ETXBCC gt Not Full XXXX DLE ACK OK 11573 6 39 Chapter 6 Communication Protocol When a slave station s message source and sink share a common memory pool as in the 1771 KG module it may be that the message sink full indication results from an abundance of messages in the message source which use up all free pool memory In this case the memory can be freed up by receiving messages from that slave station Waiting for the memory to clear by the action of the slave station alone may not wo
13. Index 1 3 Testing the Local Station 7 16 Testing the Remote Station _7 18 Timeout 6 65 Timeout Preset Value 5 31 TNS 6 44 Transceiver Actions 6 33 Transmission Codes 6 3 6 24 Transmitter Actions 6 11 Troubleshooting 7 20 Troubleshooting Aids 7 1 Two Way Simultaneous Operation 6 7 U UART Sharing _D 10 Unprotected Bit Write 6 61 Unprotected Block Read 6 61 Unprotected Block Write 6 62 Upload 6 64 Upload Download Procedures 6 62 User Programmed Timeout Optional 5 94 W Writes 3 3 Oe Rockwell Automation Allen Bradley a Rockwell Automation Business has been helping its customers improve pro ductivity and quality for more than 90 years We design manufacture and support a broad range Allen Bradley of automation products worldwide They include logic processors power and motion control devices operator interfaces sensors and a variety of software Rockwell is one of the worlds leading technology companies Worldwide representation M Argentina e Australia e Austria e Bahrain e Belgium Brazil e Bulgaria e Canada Chile e China PRC e Colombia e Costa Rica Croatia e Cyprus e Czech Republic e Denmark e Ecuador e Egypt e El Salvador Finland e France e Germany e Greece e Guatemala e Honduras e Hong Kong e Hungary e Iceland e India e Indonesia e Ireland e Israel Italy e Jamaica e Japan e Jordan Korea e Kuwait e Lebanon e Malaysia e Mexico e N
14. NU Allen Bradley PLC 2 Family RS 232 C Interface Module Cat No 1771 KG User Manual Table of Contents Introduction ine ein i a we new ee ee 1 1 General 2 0 ott ted shed entium 4 4 Document Organization u nan ccc cee eee eee 1 1 Compatible Processors 0 c cece e eee eens 1 2 Module Description 00 c cece eee eens 1 2 Series B Enhancements 0 cece eee ceeeee 1 5 Sp cifications esu EEERIXEORES an sdewe deeb vee sees E 1 5 Application Considerations 2 1 Generali cesi RE un oS era ue AS PURI 2 1 Communication Modules 0 00 cee anaana 2 1 Data Highway Network nnana anaana aanne 2 2 Stand Alone Links ice cep eere anaana aaa 2 4 Configuration Selection 00 cece eee eens 2 7 A Second Link MR 2 8 Communication Concepts seeuee 3 1 General cbe neeigeepe ed ewe do ber DERI I 3 1 Communication Links 000 c cece eee eee ee 3 1 Message Structures 0 ccc cece eee eee eee es 3 1 Error Checking and Data Security 000 eee 3 5 Link Layer Protocol on Data Highway Link 3 8 Installation iis isos eens ER RE eee AER EUER 4 1 Generi ocsi gaer dees ee eek anre eR che dex a 4 1 Switch Settings 0c cece eee eee ee eee 4 1 Cu es seu av ele w ous able x anene wy a hoe Seem eps Moe ctl greece 4 8 Module Insertion 0
15. 3 7 15 and 31 If the first poll gets a response mastership transfers immediately If a subsequent poll receives a response a descending binary search starts If there is no response to the fifth ascending poll continuous global polling starts The current master enters a state of continuous global polling after any other polling sequence has failed to select a station The master continuously sends normal polls to all stations until it receives a response It then gives one global priority poll to determine whether a high priority or normal priority descending binary search should be done then starts the appropriate descending search A single station poll is a special case that is encountered at the end of a descending search or the beginning of an ascending search Any time a single station is polled and it responds the old master relinquishes mastership to the polled station Figure 3 3 shows this polling process Chapter 3 Communication Concepts Link Disconnect Floating master operation continues normally as long as all stations share mastership of the Data Highway link However if any one station retained continuous control of the communication link due to a fault condition floating master operation would not be possible and Data Highway communication would be disabled As a guard against this type of situation each station interface module has automatic link disconnect circuitry Figure 3 3 Polling Process Mast
16. All Errors of Odd Numbers of Bits All Burst Errors of 16 Bits or Less 99 997906 of 17 Bit Error Bursts 99 998 of 18 Bit and Larger Error Bursts The CRC value is calculated based on the value of the data bytes and the ETX byte using the polynomial x16 x 5 x x To transmit the data value of 10 hex you must use the data code DLE DLE However only one of these DLE data bytes is included in the CRC value Embedded responses are not included in the CRC value Chapter 6 Communication Protocol At the start of a message packet the transmitter clears a 16 bit register for the CRC value As a byte is transmitted it is exclusive ored with Bit 0 to the right to the right eight bits of the register The register is then shifted right eight times with zeros 0s inserted on the left Each time a one 1 is shifted out on the right the following binary number is exclusive ored with the 16 bit register value 1010 0000 0000 0001 As each additional byte is transmitted it is included into the value in the register in the same way After the ETX value is included into the value in the register and is transmitted the value in the register is transmitted right bit first as the CRC field The receiver also calculates the CRC value and compares it to the received CRC value to verify the accuracy of the data received Two Way Simultaneous Operation On a two way simultaneous link two physical circuits connect four distinc
17. As Figure 5 12 shows the done bit is reset only after the start bit is reset Note that this programming causes continuous retry of a command in the event of faulted operation 5 25 Chapter 5 PC Programming Figure 5 16 Timer Initiated Command Done 032 046 IN TON 02 1 0 PR 010 AC 000 Timed Bit Start 046 032 TM E 3 15 12 Done Start 032 032 f U 02 12 Local Fault 033 IN L 02 Remote Fault EL L 12 11549 Retry Delay In some cases automatic retry as implemented in Figure 5 14 Figure 5 15 and Figure 5 16 can load down the network unnecessarily Message transfer attempts that result in local faults can take many times as much time as the normal message transfer time This could adversely affect the performance of other stations You can reduce the impact of automatic retries by providing a time delay before each retry as shown in Figure 5 17 In this example a 5s time delay was added to the example in Figure 5 15 When the local or remote fault bit goes ON the timer starts Only after the 5s time delay is the start bit turned ON again to initiate an automatic retry of the command 5 26 PC Programming Figure 5 17 Retry Delay Rung 1 Input Compare Transition 111 011 020 dite L 11 11 00 Input Compare 111 011 J E 11 11 Rung 2 Input Compare 111 011 L1 11 11 Rung 3 Transi tion Timeout Start 020 035 032 f
18. Low Byte 11396 Addressing Appendix C Data Manipulation There are two types of addressing that a computer can use in command messages it transmits to PLC 2 family stations Logical Physical Logical Addressing Logical addressing refers to the type of addressing that a PC uses in its ladder diagram program to access its own data table memory This is the same type of addressing you would use in non physical commands that is in commands that access only PC data table memory PLC 2 family controllers access their data tables by using an octal word address In PLC 2 command messages this type of logical word address must be represented as an equivalent byte address This byte address appears in the two byte field labeled ADDR in the message block formats To encode a logical PLC 2 address first convert the octal word address to whatever number system you are using in your computer application programs Next double this converted word address to get the corresponding byte address Place the result in the ADDR field low byte first For example to address Word 020 you would first convert the octal value 20 to the desired base In this example let s use hexadecimal values Octal 20 is 10 hex Doubling this value gives 20 hex for the byte address You would then code the value 0020 hex in the ADDR field of the message low byte first In binary format ADDR would look like
19. ON Enabled OFF Disabled Parity e ieri Protocol OFF OFF OFF None BCC Disabled ON OFF OFF Even Full Duplex Peer to Peer OFF ON OFF None BCC Enabled ON ON OFF Even FF FF N N 2 2 S e BCC Disabled Half Duplex Slave ON OFF ON Even OFF ON ON None CRC Enabled Full Duplex Peer to Peer ON ON ON None CRC Disabled Half Duplex Slave ites 7 12 Start Up Procedures Chapter 7 Start Up and Troubleshooting A careful start up procedure is essential to proper network operation With a well planned start up procedure you can test cabling connections module set up and support programming for module communication at each station The start up of a newly installed network requires combined efforts of maintenance personnel the programmable controller programmer and in many cases the computer programmer Because applications vary widely our recommendations in this section are general Specific start up procedures depend on the exact nature of the individual application For the procedures of this section we assume that you have made the following preparations The station is assembled using compatible components as described in Chapter 4 Your application programming at the station processor includes the communication zone and the necessary support programming for initiating and monitoring user commands as described in Chapter 5 Your application program is fully tested This last poi
20. Open the module locking latch on the I O chassis and insert the module into the slot keyed for it Firmly press to seat the module into its backplane connector Secure the module in place with the module locking latch CAUTION Do not force a module into a backplane connector if you cannot seat a module with firm pressure check the alignment and keying Forcing a module can damage the backplane connector or the module 4 9 Chapter 4 Installation Cabling 4 10 After you have placed the 1771 KG module into a 1771 I O chassis slot within 10 cable feet from the PC processor you can begin connecting the cables necessary for your application Cables that you might connect to the 1771 KG module are listed in Table 4 B Table 4 B Cables 1770 CG 16 5 feet b m RS 232 C PORT connector to a computer 1770 CP 16 5 feet 5 m RS 232 C PORT connector to a MODEM 1770 CN 1 5 feet 0 46 m PROCESSOR connector to a Mini PLC 2 or 2 15 processor PROGRAM INTERFACE connector to a 1770 RG module 1771 CO 3 5 feet I m PROCESSOR connector to a Mini PLC 2 or 2 15 processor PROGRAM INTERFACE connector to a 1770 RG module 1771 CR 10 feet 3 1 m PROCESSOR connector to a PLC 2 20 or 2 30 processor PROGRAM INTERFACE connector to a 1770 RG module 1772 TC 10 feet 3 1 m PROGRAM INTERFACE connector to a programming terminal Chapter 4 Installation To PC Processor You must connect a cable between the P
21. RS 232 C links through which the PLC 2 family processor can communicate Figure 2 5 You can alternately connect a Series B 1771 KG module and a Series B 1771 KA module to provide both an RS 232 C link and a Data Highway link through which the PLC 2 family processor can communicate Figure 2 6 The first module connected directly to the PLC 2 family processor has the same communication throughput as a single module The second module connected to the PROGRAM INTERFACE connector of the first module has a reduced communication throughput This capability to provide a second communication link was not available on the superseded Series A version of the module Figure 2 5 C hapter 2 Application Considerations g A Second RS 232 C Link for PLC 2 Family Processor PLC 3 Processor 1771 KA Computer Module 1771 KG 1771 KG Module Module PLC 2 20 Processor 11534 2 9 Chapter 2 Application Considerations Figure 2 6 An RS 232 C Link and a Data Highway Link for a PLC 2 Family Processor Computer RS 232 C Link 50 Cable Ft Max PLC 4 Loop 1771 KF 1773 KA Module Module Data Highway Link e _ RS 232 C Link 50 Cable Ft Max 1771 KG 1771 KA 1771 KA Module Module Module PLC 2 30 PLC 2 15 Processor Processor 11535 2 10 General Communication Links Message Structure
22. including the data table from any station PC The computer can then use physical write commands to download a PC program including the data table There are many advantages to computer capability for storing and downloading of programs for station PCs The computer can store multiple programs for a PC allowing quick change of a PC program without the need to manually load a new program Programs can also be stored for backup to prevent costly downtime if PC memory is inadvertently lost Chapter 5 PC Programming Command Initiation and Monitoring 5 18 This section describes the support programming for commands at each station processor This programming uses the start done and remote local fault bits to initiate and monitor command execution Using these recommended techniques you coordinate communication zone programming with your application program Start Done Fault Bit Timing The start bit which initiates a command is program controlled the done bit which indicates command completion is 1771 KG module controlled The timing relationship of start and done bits is important when you initiate and terminate commands The following sections describe this relationship in normal operation and describe the automatic responses which result from faulted operation NOTE The 1771 KG module s scan and its control of the fault and done bits is asynchronous to the PC processor s scan and its control of the start bits Norm
23. ity of Receive Buffer Clear CRC Accumulator GETCODE Get a Code Output Fla e ACK if Message is OK e NAK if Message is in Error e Oif Message is to be Ignored No Code No Station No Buffer Availaple No Buffer Overflow No Save Byte SSeS GETCODE Get Next Code No 9 Return An Ignore Flag 0 Yes Appendix D Detailed Flowcharts Was Buffer Avallable Did Buffer Overflow Message Too Small Compare Mes sage with HEADER Duplicate Message No Save New Header 1 SENDNET Send Link Data to Network Layer Y GETBUF Try to Get Another Buffer Return an ACK 11678 D 21 Appendix D Detailed Flowcharts Figure D 27 GETCODE Subroutine GETRAW Get Byte from UART CRC No Add Data Byte to CRC Yes ERAN Return Byte Get Byte from UART and Data Flag Save ACK or NAK in RESP Output a ived WAKEUP e BYTE What was received Resume XMIT e Control Data Flag Set if BYTE is if Sleeping a control character which was at WTRESP preceded by a DLE NOTE CRC should now equal zero Return Byte GRE and Control Flag Include ETX
24. 02 08 09 06 00 10 10 04 03 10 03 D2 DLE STX Data DLE ETX BCC In this case the sum of the data bytes is 2E hex because only one DLE text code is included in the BCC So the BCC is D2 hex Chapter 6 Communication Protocol The BCC algorithm provides a medium level of data security It cannot detect transposition of bytes during transmission of a packet It also cannot detect the insertion or deletion of data values of zero within a packet Cyclic Redundancy Check The cyclic redundancy check CRC algorithm provides a high level of data security It can detect All Single Bit and Double Bit Errors All Errors of Odd Numbers of Bits All Burst Errors of 16 Bits or Less 99 997 of 17 Bit Error Bursts 99 998 of 18 Bit and Large Error Bursts The CRC value of a slave message packet is calculated based on the value of the data bytes and the ETX byte using the polynomial x16 x x2 x0 The CRC value of a master message packet is calculated based on the value of the STN byte the STX byte the data bytes and the ETX byte To transmit the data value of 10 hex you must use the data code DLE DLE However only one of these DLE data bytes is included in the CRC value At the start of a message packet the transmitter clears a 16 bit register for the CRC value As a byte is transmitted it is exclusive ored with Bit O to the right to the right eight bits of the register The register is then shifted right eight tim
25. 120 027 Bit Write ee ee eas di i Ee sq 11 02 00 01 02 03 07 aang 120 120 120 120 fh e E 04 05 06 07 120 120 135 126 REDE E 10 11 11 00 027 Delimiter U Rung El 07 Header and Delimiter rungs are required for each station processor Memory Access and Command rungs are programmed as needed 11541 Note that the order of these communication zone rungs is as follows 1 Header Rung 2 Memory Access Rung s as Needed 3 Command Rung s as Needed 4 Delimiter Rung 5 2 Chapter 5 PC Programming The communication zone rungs must always appear in this order Note that the figures in this section show the addresses above most GET instructions but not the three digit data value displayed below the GET symbol This convention is used for clarity since for the most part only the GET address is significant when entering your program In entering communication zone rungs no data need be programmed into the GET instructions Header Delimiter Rungs A minimum communication zone consists of a header rung and a delimiter rung With these two rungs the local station can accept and reply to commands other than protected write from remote stations Without these two rungs the 1771 KG module turns on its PROG indicator to tell you that there is a problem with the program The delimiter rung defines the end of the communication zone This rung must be exactly as shown in Figure 5 1 The unlatch 02707 instruct
26. 2 3 ol 0 F F Digit Digit Ax 0 0 OFF OFF OFF 1 1 OFF OFF ON 2 2 OFF ON OFF 3 3 OFF ON ON 4 ON OFF OFF 4 ON OFF OFF 5 ON OFF ON 5 ON OFF ON 6 ON ON OFF 6 ON ON OFF 7 ON ON ON 7 ON ON ON Least Significant 11305 A package of plastic keys Cat No 1777 RK is provided as standard with each I O chassis When properly installed these keys can guard against the seating of all but a selected type of module in a particular I O chassis module slot Keys also help align the module with the backplane connector Misalignment could result in short circuits Each module is slotted in two places at the rear edge Position the keys on the chassis backplane connector to correspond to these slots to allow the seating of the module Use long nosed pliers to insert key into the upper backplane connectors Position the keys between the numbers at the right of the connectors Refer to Figure 4 5 for the keying positions Module Insertion Chapter 4 Installation Figure 4 5 Keying Diagram Y Er 2 2 8 8 Ts i Keying 34 14 Positions 13 ig 20 20 22 22 24 24 26 26 28 28 30 30 32 32 34 34 36 36 E cae EAM 10346 You can reposition keys if it becomes necessary to use a different type of module Remove power from the I O chassis before inserting or removing a module
27. 3 E uU e shooting 00 10 4 ZCL The input image table bit examined in Rung 1 must always be turned OFF by the processor I O scan This bit can be any unused input image table bit For this purpose choose a bit for which the corresponding I O chassis slot contains an output module Because the processor turns this bit OFF on each I O scan the ZCL zone is disabled unless both of these conditions are met 7 9 Chapter 7 Start Up and Troubleshooting 7 10 The industrial terminal is connected to the module PROGRAM INTERFACE socket The addressed input image table bit is forced ON When both conditions are met you can initiate and monitor the commands programmed at a station processor To test individual commands enter the addresses of the corresponding start and done bits into Rungs 2 and 3 In this manner you can test each command individually These rungs send the command continuously as long as the ZCL zone is enabled As a quick check of this continuous command execution and completion you can add another rung to the test rungs within the ZCL zone This rung examines the start bit as the input condition to a counter as shown in Figure 7 5 Using this optional counter you verify that the command is being executed continuously To use this optional counter insert this additional rung within the ZCL zone between Rungs 3 and 4 Figure 7 5 Optional Test Counter Increments to show continuous
28. 4 Remote Starting Ending Station No Address Address J Words e hhi 010 020 023 8 6I 18 N 023 7 7 7 RENS ZZ Z nstruction Required Uf Yy 14444 11313 Multiple memory access branches can be listed in a single memory access rung Note that each group of three GET instructions must be preceded by a branch start instruction This is true in all cases even where only one memory access branch is defined Branch end instructions must be used to fit the memory access rung into the ladder diagram display format You should end each memory access rung with an energize 02707 instruction Figure 5 4 shows memory access rung with multiple branches This rung lists the remote station which may control specific data table words using protected commands as follows Station 020 can control Words 070g 076g Station 017 can control Words 0638 065g and Word 022g Station 010 can control Words 0608 062 5 5 Chapter 5 PC Programming Branch Start Instructions Begin Each Branch 5 6 As shown in Figure 5 4 a single remote station may be identified in more than one memory access rung branch Figure 5 4 Typical Memory Access Rung Use Branch End Instructions as Needed 020 070 076 Y 017 022 022 027 G8 168 3468 1 8 46 48 000 000 000 000 000 000 x 07 One Branch End 017 063 de Hu 060 062 Instruction Must 6 316 316 148 46 186 Precede
29. Adjacent Status Words A Command Rung Start Bit 03210 02707 eaea Selection of Start Bit Automatically Desig B Start Done and Remote Local Fault Words nates Bits in Two Adjacent Words Start Bits Done Bits gt Word 032 7 A dH dl Program 1771 KG Controlled Module Controlled ry Z Y Y Y gt Word 033 A ZA Remote Fault Bits Local Fault Bits m Bits for Command Rung Shown 11315 5 12 Chapter 5 PC Programming As its name implies the start bit initiates command execution This bit controlled by the user program is set ON to initiate the sending of a command The 1771 KG module monitors the status of start bits and executes the corresponding command when its start bit is set ON As its name implies the done bit indicates command completion This bit controlled by the module is set ON when the execution of a command is completed successfully Each command rung must examine a unique start bit Thus a single pair of start done and remote local fault words has enough bits for up to eight command rungs Should more command rungs be programmed select additional word pairs as necessary To optimize memory use and minimize the time required by the 1771 KG module to scan start bits use all eight start bits in one word pair before using another start
30. Buffer Flag Set Variables MEAGER vae e LAST Value of Last Response e HEADER DST SRC CMD STS GET BUFFER and TNS from last message Get a Buffer zi e BUFFER Whether an Empty Buffer is Read e Receiver error flag LAST NAK Reset Receiver Error Flag Y GET CODE Get Next Input Control Code SEND CTL Transmit LAST NOTE XMSG Returns ACK XMSG NACK or 0 for Ignored Message Transfer Message to Network Layer Ignore Flag 0 y No Save Response ACK or NACK in LAST 11654 D 4 Appendix D Detailed Flowcharts Figure D 4 SENDM Subroutine d Reset CRC Accumula tor SENDCTL Send DLE STX CRC Link Data pole Include Byte in CRC CRC Include ETX in CRC SENDDATA Send Link Data Byte SENDETX Send DLE ETX CRC z RETURN 11655 D 5 Appendix D Detailed Flowcharts Figure D 5 WTAK Subroutine a WTAK STARTTIME Start the ACK Timeout pte ee ae hg ee ee ea ne a te oe 71 SLEEP Receive No a Response Go to Sleep at WTRESP Yes r Indivisible Zone ELTE J y STOPTIME Common Cancel the ACK Timer e WTRESP A Sleep Location e RESP A Variable Used to Pass the
31. Flowcharts D 2 Figure D 1 Data Flow Diagram for Full Duplex Protocol Data Link Layer Physical Link Layer UART Messages Multiplexer Which Have Been Sent Row Output i Bytes SENDCTL Messages M j SENDDATA XMIT Messages SENDETX DLE to be sent ENQ n DLE ACK DLE ACK Ne ut DLE NAK CRM Empty Row Input Buffers Bytes Messages L GETCODE RCVE Received DLE Messages ENQ Network Layer 11652 Appendix D Detailed Flowcharts Figure D 2 Transmitter Routine for Full Duplex Protocol C XMIT 3 e NAK Counter is e Ti tC t imeout Counter GETMSG Internal Storage Get Message from Network Layer Reset NAK and Timeout Counters f SENDM Send Message 1 WTAK SENDCTL Wait for ACK Send NAK or Timeout is DLE ENQ 3 NAKS Received for this Message Received DLE NAK 3 Timeouts Received for this DLE ACK Message Yes Y SIGFAIL SIGOK SIGFAIL Tell Network Tell Network Tell Network Layer of Layer Message Layer of Failure Was Sent Failure l Appendix D Detailed Flowcharts Figure D 3 Receiver Routine for Full Duplex Protocol 4 i Reset
32. Layer describes the application layer Upload Download Procedures Series B Modules describes upload and download procedures The full duplex protocol resembles ANSI X3 28 1976 specification combining features of Subcategories D1 data transparency and F1 two way simultaneous transmission with embedded responses Chapter 6 Communication Protocol You can use full duplex protocol for a point to point link or a multi drop broadband MODEM link that allows two way simultaneous transmission It is more difficult to implement than half duplex because it requires you to use interrupts and multi tasking programming techniques It is intended for high performance applications where you need to get the highest possible throughput from the available communication medium Transmission Codes Full duplex protocol is a character oriented protocol that uses the following ASCII control characters extended to eight bits by adding a zero for Bit 7 See ANSI X3 4 CCITT V 3 or ISO 646 for the standard definition of these characters Control Character Hexadecimal Code STX Start of Text ETX End of Text ENQ Enquiry ACK Acknowledge DLE Data Link Escape NAK Negative Acknowledge Additionally a block check character BCC or two byte cyclic redundancy check CRC field is used at the end of each packet for error checking These bytes can be any value from 00 to FF hex As used in the following paragraphs a code is an ind
33. OFF 10339 4 1 Chapter 4 Installation 4 2 The switches are in five switch assemblies Switches are shown and described in this publication as being ON or OFF Printed on the actual switch assemblies are the words ON and OFF or the word OPEN Open corresponds to OFF These switch assemblies are identified by the nomenclature SW 1 through SW 5 This designation is printed on the printed circuit board just above each switch assembly Use a blunt pointed instrument such as a ball point pen to set these switches Never use a pencil lead could jam the switch Communication Rate Select the communication rate of the RS 232 C port through Switch Assembly SW 1 Set the switches as indicated in Figure 4 2 Fora longline RS 232 C communication link limit the communication rate according to the line length as indicated in Table 4 A Figure 4 2 Communication Rate Switch Settings Communication Rate in Bits s 110 300 600 1 200 2 400 OFF OFF ON 4 800 ON OFF ON 9 600 OFF ON ON 19 200 ON ON ON 11303 Chapter 4 Installation Table 4 A Communication Rate List for Longline RS 232 C Link Cable Length Communication Rate Limit Up to 2 000 feet 19 200 bits s 2 000 to 4 000 feet 9 600 bits s 4 000 to 6 000 feet 4 800 bits s 6 000 to 7 000 feet 2 400 bits s Series A Module Options On the Series A 1771 KG module each switch of Switch Assembly SW 2
34. OFF Disabled z mpedoeg Response ON Enabled OFF Disabled Parity ON Even Parity SW 2 OFF No Parity O1 2 3 5 N 0 B SERIES B MODULE F F A A kirst Second Module N First Module OFF Second Module koe Accept Physical Unprotected Writes ON Enabled OFF Disabled Error Embedded Parity Check Responses Protocol OFF OFF OFF None BCC Disabled ON OFF OFF Even Full Duplex Peer to Peer OFF ON OFF None BCC Enabled ON ON OFF Even FF FF N N 2 9 ons BCC Disabled Half Duplex Slave ON OFF ON Even OFF ON ON None CRC Enabled Full Duplex Peer to Peer ON ON ON None CRC Disabled Half Duplex Slave 11539 4 5 Chapter 4 Installation 4 6 First Second Module The first second module switch selections are ON First module Use this selection if you connect the module directly to the PC processor OFF Second module Use this selection if you connect the module to the PROGRAM INTERFACE connector on another Series B 1771 KG module or a 1771 KA2 module see Chapter 4 To Second 1771 KG Module and To 1771 KA2 Module Accept Physical Unprotected Writes The accept physical unprotected writes switch selections are ON The module accepts physical write commands and unprotected write commands OFF The module rejects physical write commands and unprotected write commands With a programmed EPROM installed i
35. Output 000 000 000 000 000 000 Instruction 11543 For practical reasons do not exceed the display area of the programming terminal when entering these rungs More than one memory access rung can be programmed if needed Note however that should you require multiple memory access rungs you must enter them in succession in the communication zone immediately following the header rung and before any command rung Command Rungs The command rungs direct the 1771 KG module to send command messages to a remote station Each command rung lists the type of command and the memory areas affected and allows command execution to be initiated through the user program There are two basic command rung formats which differ only in terms of the unit of memory which they control The basic command rung formats are Block Command Format Bit Command Format The block command format is for commands which transfer one or more data table words between stations These are unprotected block write unprotected block read and protected block write commands Chapter 5 PC Programming The bit command format is for commands which control one or more data table bits at another station These are unprotected bit write and protected bit write commands In both formats the command rung begins in a similar manner Figure 5 5 The first rung element is an EXAMINE ON instruction addressing the start bit The second rung element termed the
36. Path 1 DLE STX xxx DLE ETX BCC DLE STX xxxx DLE ETX BCC Path 2 DLE ACK DLE ACK Message with Parity or BCC Error and Recovery Path 1 DLE STX xx xx DLE ETX BCC DLE STX xxxx DLE ETX BCC Path 2 DLE NAK DLE ACK Message with ETX Destroyed Path 1 DLE STX xxxxx timeout DLE ENQ DLE STX xxxx DLE ETX BCC Path 2 DLE NAK DLE ACK Good Message but ACK Destroyed Path 1 DLE STX xxx DLE ETX BCC timeout DLE ENQ DLE STX xxx etc Path 2 DL CK DLE ACK Messages Being Sent in Both Directions Path 1 DLE STX xxx DLE ETX BCC DLE STX xxxx DLE ETX BCC DLE STX Path 2 DLE ACK DLE ACK Path 3 DLE STX xxx xxxx DLE ETX BCC DLE STX Path 4 DLE ACK Combined Circuit AB DLE STX xxx DLE ETX BCC DLE STX xxxx DLE ETX BCC DLE ACK DLE STX Circuit BA DLE STX xxx DLE ACK xxxx DLE ETX BCC DLE ACK DLE STX Embedded Response ACK on AB delayed slightly because ETX BCC are indivisible Embedded Response Option To simplify the design of the receiver in some cases you can disable transmission of embedded responses by turning OFF the embedded response switch If you turn this switch OFF the 1771 KG module s multiplexer cannot embed response codes while sending a message Instead it delays sending response codes until after it sends the next DLE ETX BCC sequence Half Duplex Protocol Chapter 6 Communication Protocol Half duplex protocol serves as an alternate to full duplex protocol You can select half duplex protocol by tur
37. Preset Codes Timeout Interval Sec Disabled If it is necessary to use some value other than those provided in Table 5 B compute the three digit timeout preset code as follows 1 Select a timeout preset interval This interval must be larger than 1 second For the purpose of computing the code label this number S EXAMPLE Desired Interval 7 S 2 Compute a decimal number using the desired interval of Step 1 in the following formula 8 EXAMPLE 7 8 15 5 33 Chapter 5 PC Programming 3 Convert this value to an octal value EXAMPLE 1510 17g For a brief description of decimal to octal conversion refer to the Programming and Operation Manual of the controller being used User Programmed Timeout Optional The automatic timeout of the module is a backup function This automatic monitoring routine continuously checks module interaction with other stations timing the execution of commands This automatic timeout does not check module communication with its own station processor For a backup check on module processor communication you might use an optional programmed on delay timer instruction TON With proper module processor communication the module sets either a done bit or a remote or local fault bit as a response to a command However in the event of faulted module processor communication or faulted module operation a response bit might not be set Instead the start bit would remain ON in th
38. Response Code from the Receiver to the Transmitter Get the Response Code if Any from RESP RETURN 11657 D 6 Appendix D Detailed Flowcharts Figure D 6 STARTTIME Subroutine zd STARTTIME An Implementation Dependant Routine that Schedules TIMEOUT to Be Executed at the Expiration of an Internal of Time Typically 12 Character Times RETURN 11658 Figure D 7 STOPTIME Subroutine STOPTIME J M An Implementation Dependent Routine to Cancel TIMEOUT RETURN 11659 D 7 Appendix D Detailed Flowcharts Figure D 8 TIMEOUT Subroutine PURSE hedul TIMEOUT Scheduled b e STARTTIME Aborted by WAKEUP e STOPTIME Wake Up the Process Sleeping at WTRESP If Any RETURN 11660 Figure D 9 GETMSG Subroutine GETMSG SLEEP Go to Sleep at WTMSG No Common UNLINK e WTMSG Remove a e Output Queue Message from Queue Output e A Message Boxed area above must be executed indivisibly i e with the scheduler or RETURN interrupts disabled depending on implementation 11661 D 8 Appendix D Detailed Flowcharts Figure D 10 SIGOK SIGFAIL Subroutine Place Success Place Failed Code in Message Code in Message Control Block Control Block LINK Place Message on RETURN Queue WAKEUP NET Implementation Dependent Procedure to Tell Network Layer that RE
39. Ss P X p d x d Data DLE SOH STN DLE STX From Network Layer DLE ETX PEG c Master Message Link Packet 6 27 Chapter 6 Communication Protocol Block Check The block check character BCC is a means of checking the accuracy of each packet transmission It is the 2 s complement of the eight bit sum modulo 256 arithmetic sum of the slave station number STN and all the data bytes in the packet For polling packets the BCC is simply the 2 s complement of STN The BCC does not include any other message packet codes or response codes For example if the master station wanted to send the data codes 8 9 6 0 2 4 and 3 to Slave Station 20 hex 40 octal the master message codes would be in hex 10 01 20 10 02 08 09 06 0002 04 03 10 03 CO DLE SOH STN DLE STX Data DLE ETX BCC The sum of the STN and data bytes in this message packet is 40 hex The BCC is the 2 s complement of this sum or CO hex This is shown in the following binary calculation 01000000 40 hex 1011 1111 1 s complement l 1100 0000 2 s complement CO hex To transmit the STN or data value 10 hex you must use the data code DLE DLE However only one of these DLE text characters is included in the BCC sum For example to transmit the values 8 9 6 0 10 4 and 3 hex a slave station would use the following message codes Represents Single Text Value of 10 plc 10
40. a DLE ENQ input Otherwise the receiver responds to a DLE ENQ input by sending its last response on Path 2 and continues waiting for input If the receiver gets a DLE STX it resets its BCC accumulator and data buffer to zero and starts storing the link level data in the data buffer so that it can later pass the link level data to the network layer Chapter 6 Communication Protocol While the receiver stores all link level data codes in the data buffer it adds the link level data code values to the BCC If the data buffer overflows the receiver continues summing the BCC but it discards the data The receiver also sets an error flag to indicate the occurrence of a parity buffer overrun message framing or modem handshaking error If the receiver receives any control code other than DLE ETX during this time it aborts the message and sends a DLE NAK on Path 2 When the receiver gets a DLE ETX BCC it checks the error flag the BCC the message size and the destination station number If any of the tests fail the receiver sends a DLE NAK on Path 2 If the current message packet passes the above tests the receiver next begins the duplicate message detection process In this process the receiver compares the SRC CMD and both TNS bytes of the current message with the corresponding bytes of the previous message received If these bytes are the same the receiver discards the current message and sends a DLE ACK If the current messag
41. a message packet while it is in transmission what you would see would consist of two types of bytes Header Bytes Data Bytes The methods by which these bytes are filled is determined by the nature of the station from which the block originates For example if a transaction originates from a PC station the communication module automatically fills the header bytes with information contained in the PC program s communication zone If the transaction originates from a 3 1 Chapter 3 Communication Concepts 3 2 computer station the computer programs must supply the necessary header information Command Reply Cycle Any transaction on a Data Highway network consists of two parts Command Reply This provides an extra layer of integrity by ensuring that a required action always returns some sort of status whether a code or data As a frame of reference the command initiator is always referred to as a local station and a reply initiator is always referred to as a remote station Unless noted otherwise whether in a Data Highway link or a stand alone link the discussion will be limited to a single local station and a single remote station The header distinguishes a command from a reply Obviously the data area of a command and its corresponding reply depends on the type of command Priority Each message on a Data Highway link is classified as either High Priority Normal Priority The priority levels o
42. 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 retry is not to be confused with the retry procedure of the module itself Transparent to your programming the module automatically attempts three retries of a message before it sets a fault bit Programmed retry has distinct advantages As the 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 This eliminates the need for a manual reset of the start bit when a fault condition is corrected Once the command is completed the program automatically unlatches the start bit On Off Input Status You can use the ON or OFF status of an input device to latch the start bit Figure 5 14 shows example rungs for this type of command initiation 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 module In normal operation the start bit is latched by the input 11111 The fault bits initially are OFF This causes the module to format and send the command message Then when the command is completed the modu
43. always used in connection with some type of indivisible process interlock Indivisibility is achieved on many processors as on the Z80 by disabling processor interrupts For this reason SLEEP and WAKEUP assume that interrupts are OFF when they are called They will always return with interrupts OFF When one process calls SLEEP the result is a return from a call to WAKEUP by another process When a process calls WAKEUP the result is a return from a call to SLEEP by another process An interrupt subroutine that calls WAKEUP is viewed as a subroutine of the interrupted process Figure D 20 shows an example of interaction between SLEEP and WAKEUP In this example Process B woke up Process A some time ago Now at 1 when A goes to sleep actual execution resumes after the wakeup call in B at 3 and 4 Some time later Process C at an interrupt for example calls WAKEUP at 5 Execution flow proceeds to the instructions at 8 following the call to SLEEP in Process A The next time A calls SLEEP the WAKEUP call in C will terminate Figure D 20 SLEEP and WAKEUP Interaction PROCESS A PROCESS B PROCESS C A Previous Wakeup SLEEP 3 C 4 Later 8 WAKEUP NOTE Sequence of processor execution is indicated by circled numbers 11672 D 17 Appendix D Detailed Flowcharts This is not the only possible implementation of SLEEP and WAKEUP A second alternative impl
44. area of PC memory Any read can request up to 122 words of contiguous data Writes There are several layers of distinction to be considered regarding writes Writes are layered both for application reasons and for security As an application issue writes are divided between bit writes and block writes Bit writes allow the local station to control bits in the data table of a remote station Block writes allow the local station to write up to 121 contiguous words of data into the remote station s memory provided you abide by the restrictions described next As with reads writes also are defined by the level of access to PC memory Non physical writes can access only the data table at a remote PC physical writes can access all of user memory including the program area of memory 3 3 Chapter 3 Communication Concepts 3 4 Non physical writes can be further subdivided to protected and unprotected Protected writes are accepted at a remote PC only if you have programmed memory access rungs into the remote PC s communication zone If the protected write tries to write into an area other than that specified by the memory access rungs the command is rejected and an error code is returned Unprotected writes will access any area in a remote PC s data table without needing memory access rungs Each of these writes can be selectively blocked at the remote station by setting a switch at the PC communication module Diagnosti
45. begin BCC 0 GET CODE while it is a data code begin if buffer is not overflowed put data in buffer GET CODE end if the control code is not a DLE ETX then send DLE NAK else if error flag is set then send DLE NAK else if BCC is not zero then send DLE NAK else if message is too small then send DLE NAK else if message is too large then send DLE NAK else if header is same as last message send a DLE ACK else if message sink is full send DLE NAK else begin send message to message sink send a DLE ACK save last header end end else if DLE ENQ then send LAST RESPONSE else LAST RESPONSE NAK end GET CODE is defined as loop variable GET CHAR if char is nota DLE begin add char to BCC return the char and data flag end else begin GET CHAR if char is a DLE begin add char to BCC return a DLE and a data flag end else if char is an ACK or NAK send it to the transmitter else if char is an ETX begin GET CHAR add char to BCC return ETX with a control flag end else return character with a control flag end end end GET CHAR is defined as an implementation dependent function that returns one byte of data from the link interface hardware 6 18 SOURCE XMTR Chapter 6 Communication Protocol Full Duplex Protocol Diagrams The following figures show some events that can occur on the various interfaces Control characters are shown in bold type Link level data is represented by xxxx Line noise is represented by BCC is
46. discards each message while sending an error code back to the source The master can use this to clear the message source buffer of each slave after the master has been down Half Duplex Protocol Diagrams The following figures show the events that occur on various interfaces Control characters are shown in bold type Link level data is represented by xxxx Line noise is represented by Each message packet is shown ending in BCC although you can alternately use CRC Time is represented as increasing from the top of the figure to the bottom Figure 6 17 shows normal message transfer from the master to a slave Figure 6 17 Normal Message Transfer SOURCE SOURCE SINK MASTER LINK SLAVE SINK XXXX DLE SOH STN DLE STX xxxx DLE ETXBCC gt Not Full XXXX gt ex DLE ACK OK 11567 6 35 Chapter 6 Communication Protocol Figure 6 18 shows a message transfer in which the BCC was invalid After a timeout the message is retransmitted After the retransmission the response is DLE ACK Figure 6 18 Message Transfer with Invalid BCC SOURCE SOURCE SINK MASTER LINK SLAVE SINK XXXX DLE SOH STN DLE STX DLE ETXBCC Timeout DLE SOH STN DLE STX xxxx DLE ETXBCC Not Full XXX gt x DLE ACK OK 11568 Figure 6 19 shows a message transfer in which the acknowledgment was destro
47. done word For the same reason sequentially group command rungs which use the same start done word You cannot use Word 077 or the last data table word for start done words Remote Local Fault Word As Figure 5 9 shows that selection of a start bit in the program not only causes the 1771 KG module to control a corresponding done bit to be controlled in that same word but also causes the 1771 KG module to control remote and local fault bits in the next data table word A remote fault bit and local fault bit are controlled for each command For a command the position of each of these fault bits within their respective bytes corresponds directly to the position of start and done bits for that command Remote and local fault bits are controlled by the module The module sets a fault bit ON when a command cannot be executed due to a hardware related fault either between stations or between the remote station module and its station processor Figure 5 10 summarizes the significance of these bits Note that a remote fault bit indicates that the remote module received a message but could not communicate with its station processor to execute that command A local fault bit indicates that the local station has not received a response from the remote station to acknowledge that it received a valid command 5 13 Chapter 5 PC Programming 5 14 Remote Local Fault Bit Significance
48. ee 1 Remote Fault Possible Source 5 e Remote Station Processor in Program Load or PROG Mode PLC e Command Not Executed Due to Module Switch Setting at Remote Station e Fault at Remote Station Processor Power Off at Remote Station Processor Error Detected in Communication Zone of Program at Remote Station Processor o o b c Remote Station 11316 7 7 Chapter 7 Start Up and Troubleshooting 7 8 Figure 7 3 Header Rung Error Code Storage Word Location Local Timeout Station No Preset Code Message Attempt P Code 011 077 015 017 027 Geaa e L CEE 07 Legend C Least Significant Digit of Rung Number for Programming Error or Least Significant Digit of Error Code Counter EE Error Code 11574 Test Rungs For start up and troubleshooting testing you should have some means to control each start bit To execute a command during testing you can then turn ON the start bit for each command using these means The start bit is controlled by a rung of your application program The most direct way to control the start bit in troubleshooting therefore would be to manipulate the conditions of this rung to turn ON the start bit If you can do this easily for each start bit at a station processor the use of any special procedure for command initiation is unnecessary However it may not always be practical to simulate application conditions to test a command In this ca
49. formats of the different types of messages that can be generated at the application level for transmission over the link If you are connecting the 1771 KG module to another Allen Bradley communication interface module such as a 1771 KG 1775 KA 1773 KA or 1771 KE KF module then you need not be concerned with the protocol described here because the modules automatically take care of it However if you are connecting the 1771 KG module to a computer then you must program the computer to understand and to issue the proper protocol as described in this chapter A physical link consists of a cable and associated hardware such as transmitter and receiver circuits Protocol is the set of programming rules for interpreting the signals transmitted over the physical link by the hardware devices You can connect the 1771 KG module to either of two types of physical links Point to Point Link Multi Drop Link You can select the 1771 KG module to provide either Peer to Peer Communication through a Full Duplex Unpolled Protocol Master Slave Communication through a Half Duplex Polled Protocol 6 1 Chapter 6 Communication Protocol Full Duplex Protocol 6 2 The type of communication protocol you can use depends on the type of physical link you have Fora point to point link you can use either a peer to peer or master slave communication protocol Foramulti drop broadband MODEM link you can use either a peer
50. fully define the protocol environment you must tell the master transceiver where to get the messages it sends and how to dispose of messages it receives These are implementation dependent functions that we call the message source and the message sink respectively Figure 6 15 Slave Transceiver Network Network Packet Link Packet MASTER 2 E SLAVE SOURCE TRANSCEIVER RECEIVER SOURCE OK OK Network Network SINK Packet Packet SINK Full Full Y To Other Slaves Software Software Hardware 11566 We assume that the message source supplies one network packet at a time upon request from the transceiver and that the source requires notification of the success or failure of transfer before supplying the next Whenever the transceiver has received a link packet successfully it attempts to give the network packet portion to the message sink The message sink may be full The message sink must notify the transceiver when it is full Chapter 6 Communication Protocol Message Characteristics Half duplex protocol places the following restrictions on the network packet that is submitted to the link layer for transfer The size of a valid network packet is six bytes minimum and 250 bytes maximum The first byte of a network packet must be the station number of the receiver station see DST in Network Layer The receiver igno
51. in Figure 2 2 is a longline RS 232 C link limited to 7 000 cable feet If you require a longer distance use a MODEM link Figure 2 2 Stand Alone PC to PC Links PLC 4 PLC 3 PLC 2 30 Loop Processor Processor 1773 KA 1775 KA 1771 KG Module Module Module 1771 KG 1771 KG 1771 KG Module Module Module PLC 2 30 PLC 2 20 PLC 2 15 Processor Processor Processor 11300 PC to Computer With 1771 KG module a PLC 2 family processor can communicate directly to a computer through either a point to point link or a multi drop link Figure 2 3 shows a point to point link to a computer This is an RS 232 C link limited to 50 cable feet If you require a longer distance use a MODEM link 2 5 Chapter 2 Application Considerations Figure 2 3 Stand Alone Point to Point Link to a Computer Computer 1771 KG Module PLC 2 30 Processor 11301 Figure 2 4 shows a multi drop link between a computer and three PC processors Each PC processor can communicate with the computer but not directly with the other PC processors This type of configuration requires a modem link For a point to point link you can use either a peer to peer or master slave communication protocol For a multi drop broadband MODEM link you can use either a peer to peer or master slave communication protocol For a multi drop baseband MODEM link you mu
52. in the copy word will not change until the start of the next program scan Timeout Preset Value In addition to its remote local fault bit control the 1771 KG module also provides an automatic timer for monitoring command completion While it functions automatically during module operation this timer uses a preset value entered in the user program This feature enables the module to monitor command execution time without using timer TON instructions in the user program Figure 5 20 shows the significance of the timeout preset interval From the time the start bit is set ON the 1771 KG module must set either a done bit or a remote or local fault bit within the timeout preset interval Should the module detect no done or fault bit response within the preset interval a fault is assumed As a response to this type of timeout situation the module turns ON the local fault bit and enters the value 37 in the lower byte of the error word defined by the header rung 5 31 Chapter 5 PC Programming Timeout preset monitoring is intended as a backup for the other communication monitoring functions of the 1771 KG module It is designed to signal any condition where the module has not completed its communication with another station or detected some fault condition within a short time Because this timer is primarily intended as a backup for some local fault type of situation its preset value is not critical In the examples of this publicatio
53. message sink can be full leaving the receiver with nowhere to put a message A message can contain a parity error The BCC can be invalid The DLE STX or DLE ETX BCC may be missing The message can be too long or too short A spurious control or text code can occur outside a message A spurious control code can occur inside a message Any combination of the above can occur The DLE ACK response can be lost causing the transmitter to send a duplicate copy of a message that has already passed to the message sink Receiver B must keep a record of the last response code DLE ACK or DLE NAK sent on Path 2 Figure 6 5 If it receives a DLE ENQ the receiver sends this recorded response code again The receiver also keeps a record of the first six link level data bytes of the last message received If the SRC CMD and both TSN bytes of a new message are identical to the corresponding bytes of this record the receiver responds with a DLE ACK but ignores the new message This process is known as duplicate message detection and is part of the link level data security It guards against re execution of a message that has already been received successfully but for which the response code DLE ACK has been lost Until it receives a DLE STX or a DLE ENQ the receiver ignores all input from Path 1 except to set the last response variable to NAK With the last response variable set to NAK the receiver responds with DLE NAK to
54. of the data integrity of the highway all commands must receive a reply before the station sending the command considers a transaction complete Since the highway link treats both commands and replies as packets it takes at least one change of mastership to complete a single transaction You must format any command in the application program of the local or transmitting station For a PC the format is part of the PC user program Chapter 5 For a computer you format the message as part of the computer program Chapter 6 A station generates a reply message in response to a command message it receives The reply message indicates that a station received the command message and that the communication module has completed the sequence of events required of it for command execution For commands that read data the reply message contains the data specified by the 3 9 Chapter 3 Communication Concepts 3 10 command For commands that write data the reply message indicates that the write operation has been completed at the receiving station When the replying station is a programmable controller the reply message is an automatic function of the communication module operation and is transparent to the user program If the replying station is a computer you must program the computer to formulate the response reply message Polling To transfer mastership between stations an orderly polling scheme is used Normally mastership
55. other commands in a download procedure see Upload Download Procedures Series B Modules With a Series A module first put the PC processor into the program load mode before using the physical write command It requires a physical address Command Format 03 00 In the ADDR field specify an even address In the data field enter an even number of bytes to be written Reply Format DST SRC CMD STS TNS 43 Protected Bit Write This command sets or reset individual bits within limited areas of the PC data table memory Its access is limited by memory access rungs in the communication zone of the PC s ladder diagram program Command Format STS TNS 00 ADDR DATA ADDR DATA Up to 61 ADDR and DATA Fields DST SRC CMD 02 Reply Format 42 6 57 Chapter 6 Communication Protocol 6 58 Following each ADDR field you must include a DATA field Each DATA field must consist of a set mask byte followed by a reset mask byte In the set mask set a one for each bit you want to set In the reset mask set a one for each bit you want to reset The bits left at zero in both masks are left unchanged by this command If you set a bit to one in both masks the bit becomes reset Protected Block Write This command writes words of data into limited areas of the PC data table memory Its access is limited by memory access rungs in the communication zone of the PC s ladder diagram program Command Fo
56. restarts the timeout If the MODEM does not restore DCD within the timeout the module initiates the hang up sequence This feature allows the remote station to redial in the event the connection is lost by the phone network Note that this handshaking is necessary to guarantee access to the phone line If this handshaking protocol is defeated by improper selection of MODEM options or jumpers at the connectors the MODEM may answer a call but if the connection is lost the MODEM will not hang up It will be impossible for the remote station to re establish the connection because it will get a busy signal General Communication Zone PC Programming A Data Highway network allows access to the memory of each remote station This means that data table information at any operating PC can be transmitted to another PC or to a computer and used by that other station to control its own part of an operation In addition it allows computer originated commands to access and upload or download user programs at a PC station physical reads and writes However if the local station PC processor doesn t have a communication zone in its ladder diagram program the 1771 KG module will not initiate communication with any remote station This chapter provides you with information you need for programming a PC processor local station for communication through a 1771 KG module to a remote station In this chapter the generation of commands is discus
57. set OFF by the 1771 KG module after it senses that the Start Bit has been set OFF 11318 Table 5 A Start Done Bit Status Status Start Bit Done Bit Significance 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 1771 KG module turns the done bit OFF in its next scan 5 19 Chapter 5 PC Programming 5 20 Faulted Operation Certain fault conditions can prevent normal reception and execution of commands by the remote station To indicate the source of such fault conditions the module controls remote and local fault bits at the local station processor In general the local fault bit indicates that the intended receiving station is unable to receive and acknowledge a command message addressed to it The remote fault bit on the other hand indicates that the intended remote station communication module has received the command message but is unable to execute the command at the remote station processor For a summary of the distinction between these fault types refer to Figure 5 10 The timing relationship of these fault bits in command execution is shown in Figure 5 13 In this example the command initiated at the setting of the start bit cannot be executed due to some fault condition The module detecting this fault condition sets either a local or
58. shown at the end of each message packet However you could alternately use CRC Time is represented as increasing from the top of the figure to the bottom Figure 6 9 shows normal message transfer Figure 6 9 Normal Message Transfer LINK RCVR SINK XXXX OK SOURCE XMTR DLE STX xxxx DLE ETX BCC gt DLE ACK Not Full XXXX 11561 Figure 6 10 shows a DLE NAK response to the initial message transmission After the message is retransmitted a DLE ACK response is given Figure 6 10 Message Transfer with NAK LINK RCVR SINK XXXX OK DLE STX x x DLE EXT BCC gt DLE NAK DLE STX xxxx DLE ETX BCC gt DLE ACK Not Full XXXX 11562 Chapter 6 Communication Protocol Figure 6 11 shows the transmitting station sending a DLE ENQ sequence after a timeout because it did not receive the initial DLE ACK response Figure 6 11 Message Transfer with Timeout and ENQ SOURCE XMTR LINK RCVR SINK XXXX gt DLE STX xxxx DLE EXT BCC gt Not Full XXXX DL CK Timeout DLE ENQ DLE ACK OK 11563 In Figure 6 12 retransmission occurs when noise hits both sides of the line This type of noise destroys the DLE ACK while also producing
59. status indication for most program instructions An instruction symbol is intensified when the instruction is logically true For an input instruction this means that the condition specified by the instruction has been met For an output instruction this means that the instruction is being carried out The status indication is provided when the processor is in a run or test mode The status indication is useful in monitoring the ON OFF status of start done and remote local fault bits Chapter 7 Start Up and Troubleshooting Table 7 A Industrial Terminal Search Functions Key Sequence Response Eime E A e El El EG Positions cursor on the following program instruction Positions cursor on preceding program instruction Displays previous rung Displays following rung Displays first rung of program Displays END statement of program Single rung display Press same key sequence to restore multiple rung display The specified instruction is displayed as it appears in one location in the program Press SEARCH to display other locations where this instruction is used Displays output instructions which control the Word xxx or any of its 16 bits After initially pressing this key sequence simply press SEARCH to display each other program location in which Word xxx or its individual bits are addressed EXAMINE instructions not displayed by this SEARCH function Legend a A rela
60. these conditions and proceed to Step 2 However because this may not always be practical you can use the set of optional test rungs as described in Test Rungs You can use these rungs entered at the end of the application program to test each command individually Sample test rungs are shown in Figure 7 4 The following steps outline the procedures for programming these rungs for testing With the industrial terminal connected follow these procedures 1 Display the end of program statement The key sequence which displays this part of the program is as follows SEARCH Chapter 7 Start Up and Troubleshooting 2 Turn the processor mode select switch to the PROGRAM or PROG position 3 Enter the test rungs in the format of Figure 7 4 using the following addresses Rung 1 Enter the address of an unused input image table bit for the EXAMINE ON instruction Test Rung describes the reason for selection of this bit Rung 2 In the LATCH instruction enter the start bit address for the command being monitored Rung 3 Enter the address of the done bit for the EXAMINE ON instruction Enter the address of the start bit for the LATCH instruction Check that the format of these test rungs resembles that shown in Figure 7 4 With these rungs entered you can now initiate a command To do this use the FORCE ON function of the industrial terminal Perform the following steps 4 Tur
61. to peer or master slave communication protocol For a multi drop baseband MODEM link you must use a master slave communication protocol because the link can support only one channel In general full duplex protocol gives higher data throughput but it can handle communication between only two peer stations Half duplex protocol provides master slave polling capability and can handle communication with as many as 255 slave stations but it gives lower data throughput Half duplex protocol has a data link layer to establish a communication channel between the master and one of the slave stations and it has a network management layer to control the flow of communication across the established channel Whether you use full duplex or half duplex protocol you should use a layered approach to developing communication software for your computer You don t have to design your communication software in this layered fashion but your software must perform all the functions described for the layers in this manual In most cases it will be easier for you to implement and debug the communication software if you do follow this layered approach The three layers we refer to are Data Link Layer Network Layer Application Layer Full Duplex Protocol describes the data link layer for full duplex protocol Half Duplex Protocol describes the data link layer for half duplex protocol Network Layer describes the network layer Application
62. two digits of the error word may indicate an error in programming switch setting or certain other conditions that prevent normal communication The error word is addressed by the second GET instruction in the header rung Figure 7 3 This is the first rung of the communication zone Appendix A details the meaning of error codes in the status word Diagnostic Counters The 1771 KG module has several diagnostic counters They keep track of communication link statistics such as the number of messages and responses transmitted and received You can access these counters through diagnostic commands from a computer at a remote station Appendix B lists these diagnostic counters Chapter 7 Start Up and Troubleshooting Figure 7 2 REMOTE LOCAL FAULT Bit Significance Processor DEMO E f pi f b e e C n PLC e 5 Od oD Local Fault oS Possible Sources o e Power off at Remote Station Interface Module 2o e Unused Remote Station No Addressed B80 86 a e Station Interface Module d at Local or Remote Station Has Disconnected Itself as a L Result of Link Monitoring Local e Automatic Timeout at Local Station Station ee ee
63. with the mode select switch in the RUN or RUN PROG position the only way to turn OFF all outputs is to immediately send a physical write command to set all output image bits to zero The station will not send any commands The station will not accept any commands except set data table size mode setting physical read physical write or diagnostic commands Upload Physical reads during an upload operation have no effect on the PC memory intact However to insure a stable program image the 1771 KG module must provide a means of prohibiting program changes during an upload The module will block other access to the PC memory during upload if the general procedure for uploading from a PC follows this order Enter Upload Mode Physical Read Physical Read Exit Download Upload Mode For the enter upload mode command to be accepted by a 1771 KG module connected to a PLC 2 15 or PLC 2 30 processor the mode select switch must be in the RUN PROG or PROG position The mode select switch of a PLC 2 20 or Mini PLC 2 processor can be in any position Results of the enter upload command are Chapter 6 Communication Protocol The industrial terminal will be disabled The station will not accept any commands except mode setting or physical read commands If you have a Series A 1771 KG module the upload procedure includes sending an enter download mode command instead of an enter upload mode command Timeout A two minut
64. 1771 KG module and the processor Power OFF at the processor Fault in processor operation Processor troubleshooting is described in the appropriate manual for each controller After the processor fault is corrected the 1771 KG module automatically checks the communication zone rungs Should it detect proper programming module to processor interaction is resumed and the PROC indicator turns OFF 7 3 Chapter 7 Start Up and Troubleshooting 7 4 Industrial Terminal The industrial terminal is an invaluable aid for start up and troubleshooting It makes available such aids as status indicators value display bit ON OFF status control fault bit monitoring and error code display During initial start up procedures for multiple PC networks it is best to have at least two industrial terminals available This allows both a local and a remote station to be monitored at the same time This section briefly reviews the following industrial terminal functions which have a special importance in troubleshooting testing Search Functions Status Indication Force Functions Each of these tools is used in the sections that follow on Start Up Procedures and Troubleshooting Search Functions The search functions enable you to quickly locate and display the various parts of the program Table 7 A lists the search functions of the industrial terminal Status Indication The industrial terminal provides a
65. 32 C link limited to 7 000 cable feet If a longer distance is required a MODEM link could be used PC Programming Chapter 2 Application Considerations The ladder diagram program in a PLC 2 family processor at one station can initiate the transfer of a message to or from any other station in the network The programming of a PLC 2 family processor for communication through a 1771 KG module is described in Chapter 5 Figure 2 1 Data Highway Network PLC 3 Processor Computer 1775 KA Computer Module MODEM RS 232 C Link huc MODEM 50 Cable Ft Max Link MODEM 1771 KF Module 1771 KF Module Data Highway P4 Link 1771 KF Module Longline RS 232 C Link 7 000 Cable Ft Max 1771 KA 1773 KA 1771 KG Module Module Module PLC 2 15 PLC 4 PLC 2 30 Processor Loop Processor 11299 2 3 Chapter 2 Application Considerations Stand Alone Links 24 Data Highway Link The Data Highway link can have a trunkline of up to 10 000 feet and droplines of up to 100 feet each Each station is at the end of a dropline The peer to peer communication through the Data Highway link is accomplished through a modified token passing scheme called floating master With this arrangement each station has equal access to become the master They bid for temporary mastership based on their need to send
66. A Figure 4 12 Connection to 1771 KE KF or Another 1771 KG Module User Supplied Male Connectors Belacn 8 98 or gable RS 232 C 232 elden or Equivalent 232 BOR CRAS es 7 000 Ft Max m oL Ld 0 d eos Cat No 1778 CR L Or1771 KG j f Module 15 Pin Male 25 Pin Male Connector Connector A Connection Diagram 15 Pin Male 25 Pin Male Connector Connect the Shield Connector at One End us E eur 4 RS 232 C RS 232 C 1 alg AL 1 PORT Connector PORT Connector of 1771 KE KF of 1771 KG 2 a 3 or 1771 KG Module YX Module 14 13 NC 13 14 4 z l 2 4 User Supplied Cable 5 Belden 8723 or Equivalent 5 7 000 Ft Max 6 6 8 8 11 11 S User Supplied Male B Wiring Diagram 11311 4 18 Figure 4 13 Chapter 4 Installation Connection to 1773 KA or 1775 KG Module User Supplied Male Connectors User Supplied Cable RS 232 C Belden 8723 or Equivalent RS 232 C PORT Connector 7 000 Ft Max PIS e ae Oo MU e Cat No 1778 CR or 1775 KA Module 15 Pin Male 25 Pin Male Connector Connector A Connection Diagram 15 Pin Male 25 Pin Male Connector Connect the Shield Connector N at One End Only N
67. C It does not include any other message packet codes or response codes For example if a message packet contained the data codes 8 9 6 0 2 4 and 3 the message packet codes would be in hex 10 02 08 09 06 00 02 04 03 10 03 EO DLE STX Data DLE ETX BCC 6 5 Chapter 6 Communication Protocol 6 6 The sum of the data bytes in this message packet is 20 hex The BCC is the 2 s complement of this sum or EO hex This is shown in the following binary calculation 00100000 20 hex 1101 1111 1 s complement 1 1110 0000 2 s complement E0 hex To transmit the data value 10 hex you must use the data code DLE DLE However only one of these DLE data bytes is included in the BCC sum For example to transmit the values 8 9 6 0 10 4 and 3 hex you would use the following message codes Represents Single Data Byte Value of 10 10 02 08 09 06 00 10 10 04 03 10 03 D2 DLE STX Data DLE ETX BCC In this case the sum of the data bytes is 2E hex because only one DLE text code is included in the BCC So the BCC is D2 hex The BCC algorithm provides a medium level of data security It cannot detect transposition of bytes during transmission of a packet It also cannot detect the insertion or deletion of data values of zero within a packet Cyclic Redundancy Check The cyclic redundancy check CRC algorithm provides a high level of data security It can detect All Single Bit and Double Bit Errors
68. DST SRC CMD STS TNS FNC DATA 06 00 04 1 Byte Reply Format DST SRC CMD STS TNS 46 Set Variables This command is a combination of the set timeouts set NAKs and set ENQs commands It sets the maximum ENQs NAKs and timeouts all at once You must specify all three Command Format DST SRC CMD STS TNS FNC DATA 3 Bytes 06 00 02 Timeouts NAKs ENQs Reply Format 46 Chapter 6 Communication Protocol Unprotected Bit Write This command sets or resets individual bits in any area of PC data table memory Command Format DST SRC CMD STS TNS 05 00 Reply Format 45 Following each ADDR field you must include a DATA field Each DATA field must consist of a set mask byte followed by a reset mask byte In the set mask set a one for each bit you want to set In the reset mask set a one for each mask you want to reset The bits left at zero in both masks are left unchanged by this command If you set a bit to one in both masks the bit becomes reset ADDR DATA ADDR DATA Up to 61 ADDR and DATA Fields Unprotected Block Read This command reads a block of data from any area of PC data table memory Command Format 01 00 In the ADDR field specify the starting address In the DATA byte specify the number of bytes to read Reply Format 41 6 61 Chapter 6 Communication Protocol Upload Download Procedures Series B Modules Unprotected Block Write This com
69. Exit Download Upload Mode 07 05 47 Physical Read 04 44 Physical Write 03 43 Protected Bit Write 02 42 Protected Block Write 00 40 Set Data Table Size 06 08 46 Set ENQs 06 06 46 Set NAKs 06 05 46 Set Timeout 06 04 46 Set Variables 06 02 46 Unprotected Bit Write 05 45 Unprotected Block Read 01 41 Unprotected Block Write 08 48 1 Available on Series B module only Bits 0 through 3 of the CMD byte must be the same in the reply message as they are in the corresponding command message In current implementations this is either a command code or a command executor selector The application program must always copy this field from the command to the reply message STS The high nibble of the STS status byte is supplied by the application layer In command messages the STS byte is set to zero 6 47 Chapter 6 Communication Protocol In reply messages the STS is used for reporting either application or network error codes A value of zero should be interpreted as no error that is the message was delivered and executed successfully Non zero status can be divided into two categories remote errors and local errors Remote errors mean that a command was successfully delivered by the network but the remote station was unable to execute the command The remote station then formatted a reply with the high nibble of the STS byte containing some error code Local errors mean that your network layer was unable to deliver the me
70. GETRAW Get Low Byte of CRC t mny CRC i Include in Check CRC Include in Check GETRAW M RC neo Return EXT and Control Flag 11679 D 22 Figure D 28 GETRAW Subroutine App endix D Detailed Flowcharts a ETRAW Disable Proces sor Set Receiv Reset UART Error Flag Fre Enable UART Receive Interrupt Byte in UART Yes SLEEP Wait for RXD Interrupt at RXDWAIT Disable UART Received Interrupt Check Parity Framing and Yes er Error Flag Discard No Bad Data Get Byte from UART Enable Proces sor ts RETURN NOTE This figure assumes the use of a Z80 S10 11680 D 23 Appendix D Detailed Flowcharts Figure D 29 RECEIVE INTERRUPT Subroutine RECEIVE INTERRUPT NOTE This figure assumes the use ofa 0 WAKEUP AT RXDWAIT INTERRUPT RETURN T Figure D 30 SENDNET Subroutine i Input SENDNET e Message Buffer An Implementation Dependent Routine to Put a Message on the INPUT Queue Y Reset the BUFFER Flag RETURN Z 11682 D 24 Figure D 31 GETBUF Subroutine Appendix D Detailed Flowcharts GETBUF Is There a Buffer No GETFREE Get an Empty Buffer Is There RETURN a Buffer Yes Save Ad dress of
71. Number Systems You may use any one of the following number systems to represent data in your computer application programs Binary Binary Coded Decimal 1 Decimal Hexadecimal Octal It is up to you to design your computer application programs to make any necessary conversions from one number system to another Once you have selected the number system that is best for your applications you should try to use only that one system and convert all data values to that base to avoid confusion C 1 Appendix C Data Manipulation C 2 Binary The binary number system is probably the simplest to use for computer and PC applications because it is the most natural way to represent data bits However since the binary system uses only the digits 0 and 1 it is cumbersome to show values in binary format Each digit in a binary number has a certain place value expressed as a power of 2 You can calculate the decimal equivalent of a binary number by multiplying each binary digit by its corresponding place value and then adding the results of the multiplications Figure C 1 shows the binary representation of the decimal number 239 Figure C 1 Binary Numbers 1x2 128 1x28 64 1x25232 0x24 0 128 1x23 8 64 32 1x22 4 8 4 1x21 22 2 1 0 1x2021 23919 111011115 23949 1 1 4 0 7 14 7 115 10240 Appendix C Data Manipulation Binary Coded Decim
72. ON causing the indicator to be energized Once ON this bit remains ON as long as the timer is timing that is for at least as long as the preset interval In the example of Figure 5 19 this preset is 2 seconds It is recommended this value be set at no less than 0 5 seconds The off delay timer is useful in this application because it is continually reset when its rung conditions go true This means that the timed bit Bit 03015 remains ON for as long as any fault bit is changing state during programmed retries This keeps the output indicator ON until after the done bit indicates command completion NOTE Using the rungs of Figure 5 19 the indicator goes ON automatically at power up or whenever the mode select switch on the processor is changed from PROGRAM LOAD to any other position However the indicator only remains on initially for the preset interval After this time the indicator is valid for fault conditions Note that Rungs 1 and 2 examine all eight fault bits of each type Should fewer than eight command rungs be programmed at a station processor fewer bits need be examined Then should command rungs be added subsequently the appropriate bits could be addressed in Rungs 1 and 2 Conversely if more than eight command rungs were programmed at a station additional rungs would be needed to examine both remote and local fault bits for the additional commands Status bits controlled by these additional rungs could then be exami
73. Program Load 1 Test 2 Run 0to2 3 Reserved for Future Use 4 Remote Program Load 5 Remote Test 6 Run Program 7 Reserved for Future Use Normal No Communication with PC Processor Normal Download Mode Normal Module Shutdown Due to Errors Table 6 E Status Byte 2 Bit Values 1771 KG Module Type 2 PLC 2 20 LP1 3 Mini PLC 2 4107 5 PLC 2 20 LP2 PC Processor Type 6 PLC 2 15 7 PLC 2 30 6 53 Chapter 6 Communication Protocol Table 6 F Status Byte 9 Bit Values Revision A Revision B 0 Series A 1 Series B 5107 2 Series C Table 6 G Status Byte 10 Bit Values Bits Value Meaning First Module Second Module Accept Physical Unprotected Reads Writes Enabled Accept Physical unprotected Reads Writes Disabled 110 bits s 300 bits s 600 bits s 1 200 bits s Communication Rate 2 400 bits s 4 800 bits s 9 600 bits s 19 200 bits s Embedded Responses Disabled Enabled mE Disabled Enabled Full Duplex Disabled Half Duplex Chapter 6 Communication Protocol Enter Download Mode This command puts the PC processor into the download mode You must only use it together with other commands in a download procedure see Upload Download Procedures Series B Modules Command Format DST SRC CMD STS TNS FNC 07 00 04 Reply Format DST SRC CMD STS TNS 47 Enter Upload Mode This command puts the PC processor into the upload mode You must only use it together
74. ROCESSOR connector on the 1771 KG module and the PC processor Figure 4 6 Use a 1771 CN or 1771 CO cable for connection to a Mini PLC 2 or Mini PLC 2 15 processor Use a 1771 CR cable for connection to a PLC 2 20 or PLC 2 30 processor Connect to the INTERFACE connector on a Mini PLC 2 or Mini PLC 2 15 processor Connect to the PROGRAM PANEL connector on a PLC 2 20 or PLC 2 30 processor Figure 4 6 Connection to the PC Processor INTERFACE XMTG RCVG O ACTV O PROG O PROC Q O Intelligent RS 232 C Compatible Device Interconnector Cable Cat No 1771 CN 1 5 Ft Cat No 1771 CO 3 5 Ft Cat No 1771 CR 10 Ft Industrial Terminal Compatible with the PC PROGRAM Processor PC Processor INTERFACE 2 L INTERFACE Connector on Mini PLC 2 Processor or PROGRAM Panel Connector on PLC 2 20 or 2 30 Processor PROCESSOR nr 11306 4 11 Chapter 4 Installation To Programming Terminal To use an industrial terminal with the PC processor connect a 1772 TC cable between the PROGRAM INTERFACE connector on the 1771 KG module and the connector on the industrial terminal Figure 4 7 Note With this connection you cannot use tape cassette functions through the industrial terminal If you use two modules with the same processor Figure 4 9 you must use a 1770 T3 industrial terminal with Revision F or later firmware Fi
75. RS 232 C nl x3 se eth i PORT Connector 5 A of 1771 KG 2 3 Module Y 14 25 3 2 13 7 Nu NA 4 4 User Supplied Cable 5 Belden 8723 or Equivalent 5 7 000 Ft Max 6 6 8 8 11 20 i User Supplied Male sessed B Wiring Diagram RS 232 C PORT Connector of 1773 KA or 1775 KA Module 11312 4 19 Chapter 4 Installation RS 232 C Port 4 20 The RS 232 C PORT connector on the module does not conform to RS 232 C mechanical specifications because it is only a 15 pin connector However it does connect to circuits which conform to RS 232 C electrical specifications Additionally two circuits are provided for isolated longline transmission which do not conform to RS 232 C specifications All connections are listed in Table 4 C Table 4 C RS 232 C Port Connections Abbreviation i Input Output Chassis Shield Drain Transmitted Data TXD 2 Output Received Data RXD 3 Input Request to Send RTS 4 Output Clear to Send CTS 5 Input Data Set Ready DSR 6 Input Signal Ground GND 7 Data Carrier Detect DCD 8 Input Unused 9 Unused 10 Data Terminal Ready DTR 11 Output Unused 12 Received Data Return RXDRET 13 Input Transmitted Data Return TXDRET 14 Output Unused 15 The definitions of the signals into and out of this port are TXD carries serialized data It is output from the module RXD is serialized data input to the module RXD and RXDRET are isolated from the rest of
76. Remote station module could not communicate with its associated processor Access denied at remote station This error occurs if the local station tries to access a word outside the remote station s data table or if the local station sends a protected command bit for which the remote station s memory access rungs do not give the local station any access Execution of the command message is disabled by switch settings at the remote station Appendix A Error Reporting Low Byte of Error STS Byte of Reply Fault Bits Word in Hex Message in Hex Local Remote Meaning of Error Code The remote station processor is in program mode or is in the process of being downloaded from another station 88 80 ON Remote station is in error shutdown mode This error can occur if the remote module s PROG indicator is ON 89 90 ON Remote station interface module is out of buffer space and cannot store the received command message 8B B0 ON Remote station is in download mode or error in download command or operation not allowed in upload or download mode or operation not allowed when not in download mode 91 01 ON There is a bad connection to module s RS 232 C port or data set ready signal was not detected by that port 92 02 ON Remote station fails to respond This error occurs when the module has exceeded its maximum number of times to retry transmitting a command message This error does not necessarily mean that the remote station did n
77. SS SS SS SS eee Interrupts Yes NOTE This figure assumes the use of aZ80 S10 Return 11669 D 15 Appendix D Detailed Flowcharts Figure D 18 TRANSMIT INTERRUPT Subroutine TRANSMIT INTERRUPT NOTE This figure assumes the use of WAKEUP a Z80 S10 Resume Process Sleeping at NOTE UART transmit interrupt must TXWA be enabled and disabled without affecting the current state of the receive and status interrupt enable flags INTERRUPT MER 11670 Figure D 19 SLEEP and WAKEUP Subroutines SLEEP J WAKEUP An Implementation An Implementation Dependent Routine to The Address of a Sleep Variable Dependent Routine e The Address of a Sleep Suspend Own Process to Wake Up the Process Variable at a Sleep Variable Until Sleep Variables at a Sleep Variable Another Process Wakes if Any Is Sleeping There This One Up Typically an address of a stack or a process or context save area Aprocess can suspend itself and place its address in a sleep variable e Subsequently another process can wake up the sleeping process by RETURN referring to sleep variable When RETURN no process is sleeping at a sleep variable a WAKEUP has no effect nts D 16 SLEEP and WAKEUP Appendix D Detailed Flowcharts The SLEEP and WAKEUP subroutines are
78. TURN Queue Entry Has Been Made RETURN 11662 D 9 Appendix D Detailed Flowcharts UART Sharing Figure D 11 shows the transmitter XMIT and receiver RCVE routines sharing the transmit side of the UART XMIT transmits messages and inquiries RCVE transmits responses Therefore each must wait until the other is through before it can transmit through the UART The TXALLOC and TXFREE subroutines work together to ensure that XMIT and RCVE do not try to use the UART at the same time TXALLOC and TXFREE are called in the SENDCTRL SENDETX and SENDDATA subroutines Figure D 12 Figure D 13 and Figure D 14 Figure D 11 Sharing the Transmit Side of the UART XMIT RCVE den TXALLOC Pd y Not In Use UART Usage Signal gt BS W mao TXFREE XMIT RCVE 11664 D 10 Appendix D Detailed Flowcharts Figure D 12 SENDCTL Subroutine SENDCTL TXALLOC Input e Control Code Allocate UART or Wait SEND Transmit DLE SEND Transmit Control Ni TXFRE E Deallo cate a RE 11663 D 11 Appendix D Detailed Flowcharts Figure D 13 SENDETX Subroutine Input e CRC TXALLOC Allocate UART Common or Wait e RESP The Response Code Variable SEND Transmit DLE SEND Transmit ETX SEND Transmit CRC Low Byte Zero Out Any Pre
79. al Quite often PC data is represented in binary coded decimal BCD form In this system each group of four bits in a PC word represents one decimal number between 0 and 9 In this way each 16 bit word can represent a BCD value between 0 and 9 999 Figure C 2 shows the BCD representation of the decimal number 239 Figure C 2 Binary Coded Decimal Numbers 0x23 20 0x22 0 2 1x2122 0x20 20 0x23 20 0x22 20 3 1x2122 1x 20 1 1x23 8 0x 22 0 0x2 0 9 1x20 21 0 0 1 0 0 0 11 1 0 0 1 10241 M w lt o lt C 3 Appendix C Data Manipulation C4 Decimal The decimal number system is probably the easiest for us to use because it is the most familiar to us It uses the common digits 0 through 9 and each digit has a place value that is a power of 10 Figure C 3 However despite the convenience of decimal numbers it is often easier to convert binary data to a number system other than decimal Figure C 3 Decimal Numbers 2x 10 20010 200 3 x 10 3049 i 9 x 10 949 23910 10238 Hexadecimal The hexadecimal number system is the most compact way to represent binary data and it allows for the easiest conversion to and from binary This system uses a number set of 16 digits the numbers 0 through 9 and the letters A through F where the letters A through F are equivalent to the decimal numbers 10
80. al Operation Command execution begins when the user program turns a start bit ON normally with a latch instruction The 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 module receives the command message it acknowledges it Then while normal operation continues the remote station module reacts to the command and prepares a reply message A reply message is sent for each type of command The remote station module responds to a poll for mastership then transmits its reply message to the local calling station When the local station 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 the module resets the done bit Timing of START and DONE bits for a command is shown in Figure 5 12 The significance of START DONE bit status is summarized in Table 5 A Chapter 5 PC Programming Figure 5 12 START DONE Bit Timing Normal Operation e Q sae ON dd oZ ZZ Wifi a Command Processor e 1771 KG Response Scan Module Scan Te PPP Pg MI C Done Bit s LEGEND A Start Bit turned ON by the program B Done Bit set ON by the 1771 KG module to indicate that a command has been completed C Start Bit turned OFF by the program D Done Bit
81. at use logical addressing you will not have to be concerned with the difference Chapter 6 Communication Protocol For a block read write command always set the least significant bit of the ADDR field to zero to select the low byte of the word To allow PC read write commands to the computer set up a file in the computer to be addressed in the same way as if it were a PC data table Refer to Appendix C for a detailed description of PC addressing Figure 6 28 PC Data Table Byte Addressing A Protected Unprotected Read Write ADDR Field Least Significant Byte Most Significant Byte Transmitted First Transmitted Last 7 6 5 4 3 2 4 of 7 6 s 4 3 2 1 o 3rd 4th 5th Low ist 2nd 3rd Octal Octal Octal High Octal Octal Octal Digit Digit Digit Byte Digit Digital Digit B Physical Read Write ADDR Field Least Significant Byte Most Significant Byte Transmitted First Transmitted Last 7 6 5 4 3 2 1 O 7 6 5 4 3 2 1 0 NN Ey 4th 5th 3rd Low ist 2nd 3rd Octal Octal Octal High Octal Octal Octal Digit Digit Digit Byte Digit Digital Digit 11331 DATA The DATA field must always contain an even number of bytes because the PC data table and program instructions are made up of 16 bit words Transmit
82. ata Highway communication link Communication Controller Module Cat No 1771 KC KD KE KF The 1771 KC and 1771 KE modules must be installed in an I O chassis The 1771 KD and 1771 KF modules are stand alone modules The 1771 KC and 1771 KD modules provide peer to peer communication through an RS 232 C link They are superseded by the 1771 KE and 1771 KF modules which provide either peer to peer or master slave communication through an RS 232 C link and provide hardware handshaking The Data Highway is a local area network LAN which can allow peer to peer communication between up to 64 stations A Data Highway network is illustrated in Figure 2 1 Stations A station is made up of a computer or PC processor and the module or modules that interface it with the Data Highway link You must assign a unique number to each station at each communication module Within a station that contains a communication controller module a link is required that is auxiliary to the Data Highway link Three such stations are shown in Figure 2 1 One station is comprised of a 1771 KF module interfacing with a computer through an RS 232 C link limited to 50 cable feet Another station is comprised of a 1771 KF module interfacing with a computer through a MODEM link limited only by the nature of the MODEM link The third station is comprised of a 1771 KG module interfacing a PLC 2 30 processor with a 1771 KF module through a longline RS 2
83. ble 16 5 Ft A Connection Diagram PET i E E Module u MODEM RS 232 C PORT RS 232 C Connector of Compatible PORT 1771 KG Module Connector of MODEM 1 1770 CP Cable 16 5 Ft 1 AA e 89 2 2 BA e 9 3 XX 2 3 BB e e 4 4 CA gt B Wiring Diagram e 5 P f 5 CB 6 7 6 CC 8 hd 8 CF T es e e 11 ss 20 CD __ e 4 L 9 XX p 22 CE To d i 44 15 Pin Male Connector 25 Pin Male a 11310 4 16 Chapter 4 Installation The cable length is 16 5 feet 5 m If you need a longer cable or a male female adapter cable refer to the wiring diagram Figure 4 11 B to assemble your own cable Connect the shield at one end only Do not exceed the RS 232 C limit of 50 cable feet Most MODEMS hold the handshake lines in the proper states If not you can jumper them You can connect the module to standard American dial up MODEMS and some European MODEMS Other European standards specify that the DTR signal will cause the MODEM to answer the phone whether it is ringing or not causing the phone to always be busy Since the 1771 KG asserts a data terminal ready DTR signal while waiting for a call the module cannot be used with such MODEMS The types of dial up network MODEMS that you can use are classified into the following types Manual These are typically acoustically coupled MODEMS The connection is established by human operators at both ends who then insert the handsets
84. but that had not been acknowledged by the master station There is a limit on the number of times the slave will attempt to transmit a message If this limit has been exceeded the slave responds to this by writing an error code into its error word in the PC data table and then tries to transmit the next message from the message source If the NAK limit is not exceeded the slave tries to retransmit the current message Ifthe slave does not currently have a message to send it tries to get one from the message source If a message is available the transceiver initializes its retry counter and transmits the message in response to the poll Ifno message is available the transceiver responds to a poll by transmitting a DLE EOT To transmit a message the slave transceiver uses the same message block format as the full duplex format see Link Layer Message Packets After sending a message the transceiver keeps a copy of that message until it receives a DLE ACK from the master station or until its retry limit is exceeded Chapter 6 Communication Protocol When the slave transceiver receives a DLE ACK it discards the current message The next time the slave is polled it will send the next message available from the message source If no message is available in the message source the slave responds to a poll with DLE EOT When the slave transceiver receives a DLE NAK it takes messages from the source until the source is empty It
85. by the error code Then repeat Step 3 checking the status of the PROG indicator When the indicators on the station communication module and processor show normal operation for both stations being tested perform the procedures in Testing the Local Station and Testing the Remote Station Chapter 7 Start Up and Troubleshooting 7 16 Testing the Local Station Test the commands from each station using these procedures After completing these steps for a command verify data transfer at the receiving station as outlined in Testing the Remote Location You can use the procedures outlined here for any phase of start up and troubleshooting testing and at any time you add a command rung at a station processor During initial testing only two stations have power ON and are connected for these procedures In addition both station processors must be in test mode for initial start up testing During later phases of start up testing more than two stations may have power ON for these procedures There are two steps for testing of each command from a sending station 1 Set the start bit 2 Monitor the remote and local fault bits Each of these steps is described in a subsequent paragraph Setting the Start Bit The most direct way to control the start bit for test purposes is to duplicate the input conditions of the user program rung which latches this bit ON If it is possible to do this easily during testing duplicate
86. ceiving station These commands may access only data table areas specified in the program at the receiving station processor A memory access rung programmed at the receiving station processor defines which memory areas are accessible to a protected write command Should a protected command address a memory area not defined by a memory access rung at the receiving station that command is rejected The memory access of both unprotected read and write commands is not restricted by the program at the receiving station These commands can access any addressable data table word without the need for a memory access rung at the receiving station Unprotected commands may be disabled by option switches at either remote or local station for most communication modules The primary distinction between protected and unprotected commands is program restriction of memory access NOTE For most write operations between station processors you should use protected commands Because memory access must be allowed by the program at the receiving station processor protected commands allow programmed write protection which gives the programmer an added degree of control over command execution Commands of the unprotected type provide the same functions in transferring data but without this write protection at the receiving station Bit Write Access You can use the bit write command to control any accessible data table bit However this command must not be u
87. command code tells the remote station number type and priority of the command For most commands use normal priority Figure 5 5 Command Rung Format Start Bit Command Code AAA 027 E E Refer to px Figure 5 6 amp Figure 5 7 ds Legend AAA Remote Station Number P Priority Message 1 High 0 Normal X Command Type 0 Protected Block Write 1 Unprotected Block Read 2 Protected Bit Write 3 Unprotected Block Write 4 Unprotected Bit Write 11544 After the command code the command rung then lists the memory areas affected by the command The format of this area varies based upon the type of memory area controlled by the command The communication zone may have up to 255 command rungs A unique command rung is required for each command You should end each command rung with an energize 02707 instruction 5 7 Chapter 5 PC Programming 5 8 Examine Start Bit Assign a unique start bit to each command rung The start bits are examined by the 1771 KG module When a start bit is ON the module catries out the programmed command Control the start bit through your ladder diagram program Turn it on when you want to send the command message to the remote station Programming methods for start bit control are given later in Controlling the Start Bit Command Code Use the second element in a command rung for the command code Through the command code you must identify the fol
88. cs Diagnostic commands must originate from a device other than a PC You can use them to return status from a remote or local station or to alter some on board parameters at a local station Diagnostic commands are very useful during a start up or during on line debugging The diagnostic status command is also useful in download procedures Mode Select Mode select allows you to load a new PC program from a remote station The operation of this command varies by PC processor type The command can be issued only by a computer Error Checking and Data Security Chapter 3 Communication Concepts Summary Messages can be divided into commands and replies REPLY Read e Physical El e Unprotected Write e Bit Write Protected Unprotected Block Write Physical Protected El Unprotected Diagnostic El Counters Reset Loop Read Status Set Parameters Set Variables Set ENQs Set NAKs Set Timeout Mode Select Enter Download Mode Enter Upload Mode Exit Download Upload Mode You cannot originate these commands from a PC application program You can program them for transmission from a computer station For the most part the interaction of communication modules is transparent to the user This means that the application programs at the PCs and computers along the Data Highway network need not involve themselves with inter station protocol handshaking or control of the Data Highway link This is all ca
89. d from the receiver s separator to the transmitter 07 Number of NAKs received 08 Number of NAKs passed from the separator to the transmitter 09 Number of timeouts while waiting for a response 10 Number of ENQs sent 11 Number of messages that could not be successfully sent 12 Number of reply messages that could not be forwarded and were destroyed 13 16 bit count of messages received 15 16 bit count of ACKs sent B 1 Appendix B Diagnostic Counters 17 Number of NAKs sent 18 Number of ENQs received 19 Number of transmissions received and ACKed A retransmission is a message which has a transaction word command and source that match the previous message 20 Number of STX full duplex mode or SOH half duplex mode received This is in effect a count of the number of messages that were started 21 Number of messages characters or message fragments that were ignored 22 Number of messages that were aborted by receipt of a DLE ENQ 23 Number of messages that were aborted by the receipt of an unexpected control code other than DLE ENQ 24 Number of times there was no buffer ready for the next message when a pre vious message was ACKed 25 Number of times there was no buffer for a received message the message was NAKed 26 Number of broadcast messages received 27 Number of broadcast messages that were successfully received 28 Number of messages seen that were not for this station
90. ddressed by s output instruction T Tsi 13 01 B Recommended Technique Input Output 111 010 tul 13 01 Storage Bit 121 l TM a Control bit through bit write command M to Control Output 01001 11554 5 37 Chapter 5 PC Programming 5 38 The second restriction listed here applies to all PLC 2 Family processors For these processors when the station communication module receives a bit write command it manipulates the eight bit byte of the 16 bit memory word in which the addressed bit is located This may be the low byte containing Bits 00 07 or the high byte containing Bits 10 17 Should program instructions control other bits within this same byte there is a slight possibility that the module may write over programmed status for these program controlled bits This would occur only if the program caused a bit to be altered while the module was executing a received bit write command Therefore when using the bit write command address only bits within a byte which is set aside exclusively for control by these commands Note that this byte restriction for bit write commands does not apply to PLC processors Command Priority Occasionally it is necessary to carry out critical commands ahead of the normal sequence You can select high priority commands to be handled more quickly along the Data Highway link Each message handled by the 1771 KG module has one of these priority level
91. dicate the occurrence of a parity buffer overrun message framing or MODEM handshaking error When the slave gets a DLE ETX BCC it checks this error flag the BCC and the message size If any of these tests fail the slave ignores the message 6 33 Chapter 6 Communication Protocol If the current message packet passes the above tests the slave next begins the duplicate message detection process In this process the slave compares the SRC CMD and both TNS bytes with the corresponding bytes of the previous message received If these bytes are the same the slave discards the current message and sends a DLE ACK If the current message differs from the previous one the slave next tests the state of the message sink If the message sink is full the transceiver discards the current message and does not respond Otherwise the transceiver Forwards the current link level data to the message sink Keeps a copy of the first six bytes of the current link level data for purposes of duplicate message detection Sends a DLE ACK While waiting to receive a message a slave station could receive a polling packet that begins with a DLE ENQ sequence The slave will ignore the poll if the polling packet does not contain the slave s station number or if the BCC in the polling block is incorrect If the poll is valid then one of three conditions can exist The slave is still holding a message that it had transmitted previously
92. does not present a problem at PC stations on the link because PCs store and retrieve their data in the same order of low byte first But you must consider this order when you write a computer application program Three factors that can influence the ability of your computer to handle PC data are The size of words in your computer s memory The left to right or right to left ordering of bits within a word in your computer s memory Whether the computer considers the low order byte of a word to have an even or an odd address If your computer uses something other than two byte 16 bit words you should design your application programs to make the proper conversions from PC word addresses to computer word addresses Figure C 6 A shows a 16 bit word in PC memory Figure C 6 B shows a 16 bit computer word with right to left byte and bit order as in DEC PDP 11 34 or VAX 11 780 It also represents a 16 bit word in an eight bit processor such as Zilog Z 80 or Intel 8086 micro processor If your computer has this type of word order the conversion is straightforward Figure C 6 C shows a 16 bit computer word with left to right byte and bit order as in IBM Series 1 If your computer has this type of word order the conversion is more complex You will have to swap bytes onto and out of buffers C 7 Appendix C Data Manipulation C 8 Figure C 6 D shows a 16 bit computer word with left to right byte order and right t
93. ds of a point to point full duplex link or at different points on a multi drop half duplex link The network protocol can even handle the transfer of messages between application programs resident in the same device The network layer ignores the internal functioning of link protocols It requires that the link level driver accepts a message for delivery tries to send it and indicates whether it was delivered Program and Message Types Design of the network protocol is based on the assumption that application programs are of two types command initiators and command executors Corresponding to this division there are two message types Command Messages Initiated by command initiators and carried over the network to a command executor Reply Messages The replies that command executors send to command initiators For each command message there is normally one and only one reply The only exception is when a link delivers a message but an acknowledgment is not received to verify delivery In this case the network layer of the command initiator station generates a reply message and sends it to the command initiator in the application layer At the same time the command packet will be delivered and executed and the 6 41 Chapter 6 Communication Protocol executor returns a reply message This exception is rare In any case the command executor must generate only one reply message for each command it receives If t
94. e 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 and TNS values 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 current received message This is the process of duplicate message detection During an upload or download the TNS value is the only way to distinguish between the physical read or write reply messages 6 45 Chapter 6 Communication Protocol Application Layer Any station may have one or more command initiators It should have at least one command executor to handle diagnostics and may have more The command initiators are responsible for Creating a message packet submitting that packet to the network layer Maintaining the sequence number and the timeout Accepting the reply Canceling the timeout and sequence number Destroying the reply message packet when it is no longer needed Command executors must Create the reply message packet Copy over certain information from the command Fill in any rep
95. e PROCESSOR connector on the second module Figure 4 9 Figure 4 9 Connection to a Second 1771 KG Module First Second 1771 KG Module 1771 KG Module COMM COMM INTERFACE INTERFACE XMTG O RCVG O L ACTV D PROG D PROC Q Di MD N MER q Intelligent Intelligent RS 232 C RS 232 C ponat Interconnector Cable oU UMS EE x Cat No 1771 ON 1 5 Ft Cat No 1771 CO 3 5 Ft Cat No 1771 CR 10 Ft j 1771 TS Series B Rev F Industrial Terminal PO S aaa q PC Processor a jer eerta i LO Q PROCESSOR PROCESSOR m FU 11540 To 1771 KA2 Module Another possibility of connecting two modules for a second link is to connect a 1771 KG module for an RS 232 C link and a 1771 KA2 module for a Data Highway link You can connect the 1771 KA2 module as either the first or second module Connect a 1771 CN CO or CR cable between the PROGRAM INTERFACE connector on the first module and the PROCESSOR connector on the second module Chapter 4 Installation To Computer To provide an RS 232 C communication link with a computer connect a 1770 CG cable between the RS 232 C PORT connector on the 1771 KG module and the connector for an RS 232 C compatible port of the computer Figure 4 10 Figure 4 10 Connection to a Computer
96. e differs from the previous one the receiver next tests the state of the message sink If the message sink is full the receiver sends a DLE NAK Otherwise the receiver Forwards the current link level data to the message sink Keeps a copy of the first six bytes of the current link level data for purposes of duplicate messages detection Sends a DLE ACK Figure 6 8 is a flowchart which gives a simplified view of an example of software logic for implementing the receiver Table 6 B gives a detailed description of an example of software logic for implementing the receiver in structured English procedures In Appendix D are flowcharts which give a detailed view of an example of software logic for implementing the transmitter Chapter 6 Communication Protocol Figure 6 8 Receiver for Full Duplex Protocol C RCVE gt LAST NAK Yes Receive DLE ENQ Receive Message 2 BCC CRC OK LAST NAK LAST ACK 1 Send DLE LAST 11699 Chapter 6 Communication Protocol Table 6 B Receiver for Full Duplex Protocol RECEIVER is defined as variables LAST HEADER is four bytes copied out of the last good message RESPONSE is the value of the last ACK or NAK sent BCC is an eight bit block check accumulator LAST HEADER Invalid LAST RESPONSE NAK loop reset parity error flag GET CODE if DLE STX then
97. e local station data table The first GET element in the block read command rung lists the beginning address from which to read data Remote data table words are read in succession beginning with this address This block of words is sent into the area of the local data table bounded by the second and third GET elements in the rung Only one set of GET instructions as shown in Figure 5 6 is allowed in a single command rung Figure 5 6 Block Command Format Command Code Start Bit Local Station x Data Table Boundaries l Iec air ou aes m E 032 020 AAA BBB CCC 027 E Eee 10 00 07 eua d Remote Station Data Table Address Legend AAA Beginning Word Address at REMOTE Station for WRITE READ Operation BBB Beginning Word Address at LOCAL Station for WRITE READ Operation CCC Ending Word Address at LOCAL Station for WRITE READ Operation 11545 5 9 Chapter 5 PC Programming Bit Command Format When you enter a command code specifying a protected bit write or unprotected bit write command use the format shown in Figure 5 7 Figure 5 7 Bit Command Format Command Code Start Bit Area may contain any legal combination of these instructions EEE FFF GGG 027 a tae EE FF GG 07 HHH Il JJJ Branch Start diit It Lu If Needed HH ll JJ Legend EEEEE Turn ON the Addressed Bit at the Remote Station Turn OFF the Addressed Bit at the Remote Station 11546
98. e timer will be started when the 1771 KG module receives an enter upload mode command or an enter download mode command The timer will be restarted when any command is received If the timer times out the mode is exited as if an exit download upload command were received Addressing For physical read and write commands you must use physical addressing Figure 6 28 shows PC data table addressing Figure 6 29 shows PLC 2 family memory organization For further information on addressing refer to Appendix C Figure 6 29 PLC 2 Family Memory Organization Logical Address Octal Physical Address Word Byte Hexadecimal 000 0 0000 3 Processor Work Area T No Access Dot 001F 010 1 0020 1100 0021 110 1 Start of Data Table 0022 0023 0770 077 1 OOFC 1770 OOFD 177 1 OOFE 200 0 OOFF 200 1 0100 300 0 0101 300 1 0102 0103 11332 6 65 General Troubleshooting Aids Start Up and Troubleshooting This chapter outlines an approach to start up and troubleshooting procedures Necessarily exact procedures that would be followed vary from one application to the next However these guidelines are useful when starting up an installation or when trying to locate specific fault conditions You can use the methods described in this chapter to test any station which contains a PLC 2 family programmable controller and a 1771 KG module When you have a computer communicating to the module additio
99. eiver M 7 e o A M B PERPE SINK Status Path 2 Full Software Software Hardware 11560 Chapter 6 Communication Protocol Message Characteristics Full duplex protocol places the following restrictions on the network packet that is submitted to the link layer for transfer The size of a valid network packet is 6 bytes minimum and 250 bytes maximum The first byte of a network packet must be the station number of the receiver station see DST in Network Layer The receiver ignores messages that do not contain the correct station number As part of the duplicate message detection algorithm the receiver checks the second third fifth and sixth bytes of each network packet At least one of these bytes of the current network packet must differ from the corresponding byte of the previous network packet in order for the receiver to accept the current network packet Otherwise the receiver assumes that the current packet is a retransmission of the previous packet so it discards the current packet Transmitter Actions Whenever the message source can supply a packet and the transmitter is not busy Transmitter A sends a link packet on Path 1 Figure 6 6 It then starts a timeout and waits for a response on Path 2 You can use the diagnostic set timeout command see Set Timeout to set this timeout period for the 1771 KG module The default setting is 3 seconds When Transmitter A gets a DLE ACK the
100. ementation would allow a process to call WAKEUP without losing immediate control of the processor If B wakes up A context switching would be deferred until B itself has executed a SLEEP A third alternative would cause a context switch if a process performed a WAKEUP on a higher priority process If a WAKEUP had been performed on a lower priority process the context switch would be deferred until the first process has gone to SLEEP The first alternative is the result of implementing the driver totally at the interrupt level where scheduling is dictated by the interrupt daisy chain hardware The third alternative would be used if the driver were implemented as tasks under a multi tasking operating system Such an implementation might be easier but would probably be limited to lower communication rates POWER UP At power up the Z80 processor starts executing code at Location 0 The POWER UP subroutine starts the XMIT and RCVE processes by executing a SPAWN A SPAWN is very similar to a WAKEUP except that the corresponding SLEEP is imaginary and is located prior to the first instruction of the spawned process Figure D 21 POWER UP Subroutine POWERUP SPAWN RCVE SPAWN XMIT Continue Initialization 11673 D 18 The Address of a Queue is the Address of its Root NOTE Messages are added to the end of the queue and removed from the head Figure D 22 Message Queue ROOT F
101. er Mode H Priority Poll R NR H Priority NR Poll R j Y NR a NR Descending m Ril Ascending H Priority R1 Relinquish R1 Mastership Descending NR gt a A Y Y Global NR Relinquish N Priority Mastership R H Priority R Poll NR R Response R1 Response to Single Station Poll NR No Response 11538 3 13 General Switch Settings Installation After studying Chapter 2 Application Considerations and Chapter 3 Communication Concepts you can then make decisions about what kind of communication network you want and how you will configure your 1771 KG module After making those decisions you can install the module Module installation includes Making Module Operation Selections through Switch Settings Keying the Backplane Connector to Match the Module Connecting Cables to the Module Switches are located behind a cover plate at the top of the module Figure 4 1 Figure 4 1 Switch Assembly Locations Communication Rate Switches SW 1 Option Switches SW 2 Station Number Switches SW 3 SW 4 SW 5 ON s 1234 o o 345 9 Q F F F F HERES OFF F F O F F ON OFF
102. erating system when a message arrives on the queue Messages do not necessarily have to be removed from the queue in order of arrival Network Packet Fields As we discussed the communication protocol used on the link level we described control characters framing the network packet Here at the network level you must generate the network packet In this protocol the network packet characters are generated directly from binary coded bytes of data This provides faster throughput on the link than if this data were coded into ASCII characters Figure 6 26 shows the general format of the network packet for a command message Figure 6 27 shows the general format of the message text for a reply message Note that bytes are shown from left to right in the order in which they are transmitted on the link Figure 6 26 Command Message Packet Format From CMD STS FNC ADDR DATA Application x Layer Data Network DST SRC CMD STS TNS From Application Layer Layer 0 x Packet Legend x low hex digit of CMD byte supplied by application layer 11329 Figure 6 27 Reply Message Packet Format From CMD STS DATA Application x Layer Data Network DST SRC CMD STS TNS From Application Layer Layer 4 x Packet Legend x low hex digit of CMD byte supplied by application layer 11330 6 43 Chapter 6 Commun
103. es with zeros 0s inserted on the left Each time a one 1 is shifted out on the right the following binary number is exclusive ored with the 16 bit register value 1010 0000 0000 0001 As each additional byte is transmitted it is included into the value in the register in the same way After the ETX value is included into the value in the register and is transmitted the value in the register is transmitted right bit first as the CRC field The receiver also calculates the CRC value and compares it to the received CRC value to verify the accuracy of the data received 6 29 Chapter 6 Communication Protocol Protocol Environment Definition Each station on the multi drop link must contain a software routine known as a transceiver that can both transmit and receive message packets The 1771 KG module already contains a slave transceiver routine so it will function as a slave station if you turn ON the protocol switch To establish a master station you have to program a transceiver routine at a computer In addition to transmitting and receiving message packets the master transceiver must also be able to transmit polling packets Note that you can program separate transmitter and receiver routines instead of a single transceiver For purposes of the discussion here however we assume that the transceiver is a single software routine Figure 6 15 illustrates the operation of master and slave transceivers To
104. escribed in Industrial Terminal 3 Observe the ON OFF status for each fault bit corresponding to the command Should the remote or local fault bit be ON for the command sent some hardware related fault or programming error can be suspected Check the connections and equipment indicated in Figure 7 2 After checking a command in this manner check the receiving station as described in Testing the Remote Station Then check any other commands as necessary using the applicable procedures in Power Up Testing the Local Station and Testing the Remote Station Testing the Remote Station Check the receiving station with the sending station for one purpose verification of data transfer Although this procedure may be time consuming it is essential in initial start up testing and for testing whenever you add a command at a station Chapter 7 Start Up and Troubleshooting Upon receiving a command message the function of the station communication module is to execute the command at its station processor and to format and transmit a reply message to the sending station Proper execution of this procedure is indicated by the start done and remote local fault bits The checks performed in testing the sending station therefore can indicate and help isolate the source of a problem which prevents the command from being executed The checks at the receiving station help to verify that program addressing a
105. essages and retransmit any that are addressed to a slave station Figure 6 16 is a flowchart which gives a simplified view of an example of software logic for implementing half duplex protocol from the master station s point of view 6 31 6 32 Chapter 6 Communication Protocol Figure 6 16 Implementation of Half Duplex Protocol XeVR 7 Select Station be Y Poll Selected Station Y Start Timeout Receive Receive DLE EOT Message Message OK Yes Set Active Station Flag Active Duplicate Station Message No t Yes Get Message from Give Message to Network Layer Network Layer aeu Y Y Send Message Send DLE ACK Y 3 Timeouts No Y Start Timeout for this Poll Yes Receive DLEACK Y Remove Station from Active List 3 Timeouts for this Message Tell Network Layer of Failure 11698 Chapter 6 Communication Protocol Transceiver Actions Since the transceiver receives dirty input from the physical world it must be capable of responding to many adverse situations Some of the things that can conceivably happen are listed here The message sink can be full leaving the transceiver with nowhere to put a message A message can contain a parity error The BCC ca
106. etherlands e New Zealand e Norway Pakistan e Peru e Philippines e Poland e Portugal e Puerto Rico e Qatar e Romania e Russia CIS e Saudi Arabia e Singapore e Slovakia e Slovenia e South Africa Republic e Spain e Sweden e Switzerland e Taiwan e Thailand e Turkey e United Arab Emirates e United Kingdom e United States e Uruguay e Venezuela e Yugoslavia Allen Bradley Headquarters 1201 South Second Street Milwaukee WI 53204 USA Tel 1 414 382 2000 Fax 1 414 382 4444 Publication 1771 6 5 8 November 1985 PN 955098 90 Supersedes Publication 1771 6 5 8 March 1984 Copyright 1985 Allen Bradley Company Inc Printed in USA
107. ext higher number than the most recent master with normal priority messages Polling Selection Two group selection parameters are used in polling The first group selection parameter is priority There are two kinds of polling packets High Priority Polls Do not contain a current master number and can only be responded to by stations that have a high priority message to send Normal Priority Polls Contain the number of the current master and can be responded to by any station that has a normal or high priority message The second group selection parameter is station number A group of stations is specified by giving the number of the polling station and the size of the group A station is in the polled group if that station s number minus the polling station s number modulo 256 is less than the group size A slave station will respond to a poll if it meets all of the following conditions Slave station s priority is greater than or equal to the poll priority Slave station is in the polled group Slave station has a message to send Polling Sequences A polling sequence is a series of polls The range of stations specified in the poll command is usually altered as successive polls narrow in on the station to be selected The following types of polling sequences are used Global High Priority Poll Descending Binary Search High or Normal Priority Ascending Binary Search Normal Priority Only Cont
108. f messages determine the order in which stations are polled and allowed to transmit messages across a Data Highway link In the polling process stations with high priority messages are given priority over stations with normal priority messages You specify the priority level for each command message The command code contains this specification The station that receives a command message must establish the same priority level for its corresponding reply message At a PC processor station the communication module automatically establishes the priority level of each reply message NOTE Stations with high priority messages are given priority over stations with normal priority messages throughout the command reply message cycle For this reason a command should be given a high priority designation only when special handling of specific data is required Using an excessive number of high priority commands defeats Chapter 3 Communication Concepts the purpose of this feature and could delay or inhibit the transmission of normal priority messages Command Structures There are four basic types of commands on a Data Highway network Read Write Diagnostic Mode Select Reads There are two types of reads Physical Unprotected A physical read allows you to read any area of PC memory at a remote station However a PC processor cannot originate a physical read command An unprotected read can access only the data table
109. ful to send a command continuously between stations With the example of Figure 5 14 you can accomplish this 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 5 23 Chapter 5 PC Programming Transition You can use the transition of an input device from ON to OFF and from OFF to ON to latch the start bit This allows you to send a command each time a condition changes state Figure 5 15 shows example rungs for this type of command initiation Figure 5 15 Transition Initiated Command Rung 1 Input Compare Transition 111 011 020 A F E 11 11 00 Input Compare 111 011 J f 11 11 Rung 2 Input Compare 111 011 jh 11 11 Rung 3 Transi Remote Local tion Fault Fault Start 020 033 033 032 popup L lt 00 12 02 12 Rung 4 Done Start 032 032 LR CU Qe 02 12 Local Fault 033 jr fi L 02 Remote Fault 033 ix if RENE 12 Rung 5 Done Transition 032 020 qd pu oS 02 00 11548 Chapter 5 PC Programming In this example a storage bit called the transition bit is manipulated to control the sending of the command This bit is latched whenever a transition of Input 11111 is detected unlatched only when the done bit is set ON A compare bit 01111 is this example is used to manipulate the transition bit In Rung 2 the compare bit
110. gle Command Example Output Remote Fault Indicator 033 010 f D 10 00 Local Fault 033 afi Jia E 00 Output Done Indicator 032 010 ae U 00 00 11551 Figure 5 19 FAULT Bit Diagnostic Rungs Multiple Commands Example Rung 1 Local Fault Status 033 033 033 033 033 033 033 033 055 Dh i Se an i A Le E A as E A Co 07 06 05 04 03 02 01 00 00 Remote Fault iunge Status 033 033 033 033 033 033 033 033 055 HE EAM LEA FE e I A A E E A ME 17 16 15 14 13 12 11 10 01 Rung 3 Local Fault Status 055 030 l F TOF 00 0 1 Remote Fault Status PR 020 050 AC 000 L E 01 Rung 4 Output Timed Bit Indicator 030 010 T4 C 15 00 11552 5 29 Chapter 5 PC Programming 5 30 This example shows the fault bit monitoring for eight commands The eight local fault bits are monitored in Rung 1 As long as all eight bits are OFF Status Bit 05500 remains ON However should any local fault bit be ON Status Bit 05500 is de energized In Rung 2 the eight remote fault bits are monitored in the same manner to control Status Bit 05501 The status bits controlled by Rungs 1 and 2 are in turn used to control an off delay timer in Rung 3 The off delay timer begins to time when either of the status bits goes from OFF to ON that is when rung conditions go from true to false Bit 03015 the timed bit of the timer controls the output indicator As soon as the conditions of the timer in Rung 3 are true this bit is set
111. gramming Error codes are generally used in the application program only for display They have special value in station start up when program errors are detected in the communication zone By viewing the header rung of the communication zone you can examine a displayed error code and the least significant digit of the counter in this word The header rung is described earlier in Header Delimiter Rungs In some instances however it may be preferable to display the two digit error code using a 7 segment display controlled from output modules of the controller This 7 segment display mounted at an operator s station can be a useful troubleshooting aid for quickly locating fault conditions NOTE Error Codes 8A and 8B may not display correctly on some 7 segment displays Control of PC Programs In addition to data table access a computer on the Data Highway can access the user program area of memory of any station PC on the Data Highway This enables computer control of PC operation allowing storage of PC programs and downloading of these programs from the computer The following commands enable computer control of the PC program Physical Read Physical Write The prefix physical distinguishes these commands from the data transfer commands available to both the PC and the computer Physical commands can only be issued by a computer Using physical read commands the computer can store the ladder diagram program
112. gure 4 7 Connection to a Programming Terminal 1771 KG Module RR dedi So q Intelligent RS 232 C Compatible Device RS 232 C PORT Industrial Terminal 1772 TC Cable 10 ft Compatible with the PC Processor PROGRAM INTERFACE SSeS Sess PC Processor PROCESSOR 11307 4 12 Chapter 4 Installation To 1770 RG Module To use a PLC 2 Family Report Generation Module Cat No 1770 RG with the PC processor connect a 1771 CN CO or CR cable between the PROGRAM INTERFACE connector on the 1771 KG module and the PROCESSOR connector on the 1770 RG module Figure 4 8 Figure 4 8 Connection to a 1770 RG Module 1771 KG Module 1770 RG Module PLC 2 REPORT GENERATION BUSY XMTG RCVG PROG PRPH Intelligent RS 232 C Compatible Interconnector Cable Cat No 1771 CN 1 5 Ft oes Cat No 1771 CO 3 5 Ft PORT Cat No 1771 CR 10 Ft Device PERIPHERAL Q PROGRAM INTERFACE Dey ALTI T E Fil MU e PC Processor WO J eee as we te a PROCESSOR PROCESSOR ro mo 11308 4 13 Chapter 4 Installation To Second 1771 KG Module To use two Series B 1771 KG modules for a second RS 232 C link connect a 1771 CN CO or CR cable between the PROGRAM INTERFACE connector on the first module and th
113. he 1771 KG module cannot carry out a command due to a programming error or a discrepancy in data it writes an error code into the error word you select on the header rung of the communication zone This word stores the most recent error code written by the module Figure 5 11 shows the structure of the error word The lower byte of this word Bits 00 07 stores any error code entered by the module In this byte the error code is represented as a two digit hexadecimal number from 00 99 Appendix A lists and describes these error codes Figure 5 11 ERROR CODE Word Format Two Digit Value Reference Number for Codes 01 29 a Counter for Codes 30 99 Error Codes 00 99 in BCD Format BCD Count Refer to Table 5 A 17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00 0 9 0 9 0 9 0 9 11317 Chapter 5 PC Programming 5 16 Error codes can be grouped as follows Codes 01 29 indicate a processor problem at power up or that the 1771 KG module has detected some programming error in the communication zone of program The program status indicator PROG may be ON if one of these codes is displayed Codes 30 99 generally indicate that the 1771 KG module has detected some programming or hardware related fault during attempts at communication between stations These codes are intended to serve as diagnostic indicators after the initial power up checks of program have been comp
114. he data table size during a procedure for downloading the PLC 2 family processor s memory Second Link Capability This capability can provide two RS 232 C links to a PLC 2 family processor through two 1771 KG modules It can alternately provide an RS 232 C link through a 1771 KG module and a Data Highway link through a 1772 KA2 module Cyclic Redundancy Check The CRC provides more complete error checking than the CRC Switch Selectable block check character BCC check Separate Command to Enter This command provides a simpler upload procedure Upload Mode Electrical Interface e RS 232 C Compatible Communication Protocol e Full Duplex for Peer to Peer Communication e Half Duplex for Master Slave Communication Communication Rates e 110 300 600 1200 2400 4800 9600 or 19 2K bits s Module Location e Any I O Module Slot of a 1771 I O Chassis Backplane Power Supply e 10A Load Ambient Temperature Rat e Operational 0 to 60 C 32 to 140 F ing e Storage 40 to 85 C 40 to 185 F Relative Humidity Rating e 5 to 95 without condensation Keying Top Connector e Between 4 6 e Between 22 24 General Communication Modules Application Considerations In this chapter we describe how the 1771 KG module relates to other Allen Bradley modules which provide general communication functions for PC processors We outline various networks that you might configure and application considera
115. he network layer of the command initiator station cannot deliver a command to another station it generates a reply message with an error code for the command initiator in its own application layer If a reply cannot be delivered the network layer destroys it Network Model To implement your Data Highway network layer software use a routing subroutine and a queue Messages that have been created by the application are sent to the router for transmission over the network Messages that are delivered by the network are placed on an incoming message queue that is unique for each application Figure 6 25 illustrates this model Figure 6 25 Application Model Command Command Initiator Executor Q Q Commands Replies Replies Commands Y Y R R Network R Routing Subroutine Entry Q Incoming Message Queue 11576 Reply messages are not necessarily sent in the same order that their corresponding command messages were received It is impossible for the network to guarantee delivery and in some cases it may not be possible to provide notification of non delivery Therefore it is advisable that the command initiator maintain a timer for each outstanding command message Non deliverable reply messages are not returned to the command executor 6 42 Chapter 6 Communication Protocol The application task is notified via the op
116. he station processors in the run mode for normal operation Select one of the two stations as a starting point For the purpose of this description this station is termed Station A The station to which Station A sends a command is Station B First test message transfer between Stations A and B Test and monitor each command from A to B to verify proper operation Then check Station B for any commands which it received from Station A and for any commands which it sends to Station A By following this procedure test each command for proper execution by the communication modules at each station This testing also checks the support programming done at each station to initiate and monitor commands including remote local fault monitoring Use the procedures in Testing the Local Station and Testing the Remote Station for paired testing of stations For a station sending a command carry out the procedures of Testing the Local Station At the receiving station carry out the procedures of Testing the Remote Station Operation Once you have checked the interaction of all station communication modules you can put the station processors into operation one at a time You must determine which controller to put in the run mode initially and in what order you should add other stations in the run mode Monitoring of station interaction can continue during these procedures By adding stations one at a time you can exercise max
117. he two TNS transaction bytes contain a unique 16 bit transaction identifier field A complete transaction consists of a command message and its corresponding reply message The TNS value in the reply must be the same as the TNS value in its associated command This enables the command initiator to associate an incoming reply message with one of the command messages it transmitted previously Chapter 6 Communication Protocol For command messages transmitted by a PC station the 1771 KG module assigns the TNS values For each command message transmitted by your computer station your application programs must assign a unique 16 bit transaction number A simple way to generate the transaction number is to maintain a 16 bit counter in your application program 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 your computer program receives a reply to one of its command messages it can use the TNS value to tie the reply message to its corresponding command If the TNS value of a reply message matches the TNS value of a command message then that reply is the appropriate one for that command Whenever your computer network layer receives a command from another station it should copy the TNS bytes of the command message into the same bytes of the corresponding reply message Do not change the TNS value in a reply messag
118. ication Protocol 6 44 Note that the only difference between the network packet for a command message and the network packet for a reply message is in the high nibble of the CMD byte DST and SRC The DST destination byte is the number of the station to which this packet is delivered The SRC byte is the number of the station that sent the packet There are 239 possible station numbers from zero to 63 and 72 to 254 decimal For multi drop links a DST value of 255 indicates a broadcast command message The DST and SRC of a reply message are formed by reversing the DST and SRC of the corresponding command message CMD High Nibble The high nibble of the CMD command byte is supplied by the network layer Bit 6 26 value of the CMD byte is the command reply indicator It is zero for command messages and one for reply messages Therefore the high hex digit of the command byte is zero for command messages and four for reply messages STS Low Nibble The low nibble of the STS status byte is supplied by the network layer In a command message this field is set to zero In a reply message reporting no error or a remote error this field is also set to zero If the network layer of your computer cannot deliver a command to another station it writes a local error code into this field to generate a reply message which it returns to the command initiator in your application layer All error codes are listed in Table A A TNS T
119. iderations for them Chapter 3 provides an operational overview of communication concepts This includes message structures error checking data security and Data Highway link protocol Chapter 4 describes module hardware outlines procedures for preparation installation and connection of the module Chapter 5 describes the PC user programming of communication zone rungs needed for communication through the 1771 KG module Chapter 6 describes the protocol the module uses in communication with a computer through an RS 232 C link Chapter 7 outlines start up and troubleshooting procedures Appendix A lists Data Highway error codes and their meaning Appendix B describes the use of diagnostic counters for analyzing communication reliability Appendix C provides detailed information useful for encoding address and data fields at a computer before sending them to a PC in message packets Chapter 1 Introduction Compatible Processors Module Description The module is compatible with the following Bulletin 1772 processors Mini PLC 2 Processor Cat No 1772 LN1 LN2 LN3 Mini PLC 2 15 Processor Cat No 1772 LV PLC 2 20 Processor Cat No 1772 LP1 PLC 2 20 Processor Cat No 1772 LP2 PLC 2 30 Processor Cat No 1772 LP3 The 1771 KG module is shown in Figure 1 1 Install the module in any I O module slot of a Bulletin 1771 I O chassis located within 10 cable feet of the PC processor F
120. igure 1 1 PLC 2 Family RS 232 C Interface Module Cat No 1771 KG Bi OOOOO af om 10862 I Connections The module receives its power through the chassis backplane However all communication is through the three connectors on the front of the module Figure 1 2 The PROCESSOR connector provides cable connection to the PC processor At the PC processor the cable mates with the connector provided for industrial terminal use The PROGRAM INTERFACE connector provides cable connection to an industrial terminal for the PC processor Chapter 1 Introduction The RS 232 C PORT connector provides cable connection to an intelligent RS 232 C compatible device To allow communication with a computer more than 50 cable feet from the module a MODEM link must be used To allow communication with another Allen Bradley communication module more than 7 000 cable feet from the module a MODEM link must be used Indicators The module has five LED indicators XMTG Transmitting This green indicator is ON when the module is transmitting a message through the RS 232 C port Chapter 6 defines which transmissions are messages RCVG Receiving This green indicator is ON when the module is receiving a message through the RS 232 C port ACTV Active This green indicator is ON when a cable is connected from an RS 232 C compatible device to the receiving pins of
121. igure D 23 UNLINK Subroutine FIRST MESSAGE LAST SIZE STATUS Appendix D Detailed Flowcharts MESSAGE CONTROL BLOCKS MESSAGES NEXT __ Network Data Block NEXT MESSAGE Network Data SIZE Block STATUS 0 MESSAGE Network Data SIZE Block STATUS 11674 oak Input Address of Queue Output An Implementation Dependent Routine that Removes a Message from a Queue e Message Control Block lt RETURN 11675 D 19 Appendix D Detailed Flowcharts Figure D 24 LINK Subroutine LINK An Implementation Dependent Routine that Places a Message onto a Queue RETURN Figure D 25 CRC Subroutine Input e Address of Queue Message Block 11676 Shift Right NOTES CRC can be implemented using a 256 word table CRC CRC gt gt 8 XOR Table DATA XOR CRC AND 255 Implies Indexed Lookup The flowchart assumes the use of a Z80 S10 XOR L LD LA LD AH LD H HIGH POLLY XOR HL INC H LD H HL D L RETURN D 20 Input e A Data Byte Common e HL CRC Accumulator Clobbers e A Note The table is organized as two 256 byte tables aligned on 256 byte boundaries The first table contains the high byte and is labeled POLY 11677 Fi gure D 26 XMSG Subroutine GETBUF Check Availabil
122. imum control over the application and monitor controller behavior carefully Chapter 7 Start Up and Troubleshooting Power Up Only the two stations being examined in the first phase of start up should be ON Follow these steps in powering up each of these stations 1 Put the processor into the program load mode 2 Turn power ON at the processor and communication module Observe power supply and processor indicators for proper status 3 While observing the indicators of the module put the processor into the test mode Within a few seconds the PROG indicator on the 1771 KG module should turn ON briefly then OFF This indicates that the module has checked the communication zone rungs of the program If this indicator remains ON an error may have been detected in these rungs Should this be the case check the error code storage word as described in Step 4 If this indicator does not turn ON the header rung may be incorrect or missing Check this rung if necessary The indicator labeled PROC should be OFF If this indicator is ON check for a processor fault indication or poor cable connection 4 If the PROG indicator does not turn OFF after a few seconds check the error code storage word The error code storage word is listed in the header rung of the communication zone of the program The significance of the error code storage word is described in Error Word Correct the communication zone rungs as indicated
123. information For a more complete description of the Data Highway link refer to Chapter 3 Computer Programming The communication protocol on the Data Highway link is transparent to a computer in the network However for a computer to send or receive messages through the Data Highway network it must be programmed to communicate with its communication controller module over their auxiliary link through the protocol described in Chapter 6 A stand alone communication link is totally separate from any Data Highway link A stand alone link also provides a Data Highway network The network layer protocol is the same as for a Data Highway network which includes a Data Highway link With a 1771 KG module a PLC 2 family processor can communicate through a stand alone link directly to either another PC processor or a computer You must assign a unique number to each PC station at each communication module PC to PC Figure 2 2 shows three possible stand alone PC to PC communication links in which the 1771 KG module could be applied Each is a point to point link in which two PC processors can communicate as peers The ladder diagram program in a PLC 2 family processor at one station can initiate the transfer of a message to or from the other PC processor The programming of a PLC 2 family processor for communication through a 1771 KG module is described in Chapter 5 Chapter 2 Application Considerations Each of the PC to PC links shown
124. ink to a 1771 KE KF module which in turn interfaces with the Data Highway link Even with only two stations you may want a Data Highway link A Data Highway link would provide a 10 000 cable foot link and the flexibility of expansion to add more stations later With two stations you may want a stand alone link For a stand alone link you could use a MODEM link to provide communication between stations more than 7 000 cable feet apart Also with the full duplex peer to peer protocol and embedded responses it could be faster than a Data Highway link because it wouldn t be burdened with polling A Data Highway link has a communication rate of 57 6K bits s and a peer to peer half duplex polled protocol An RS 232 C link has a selectable communication rate of 19 2K bits s maximum and a selectable protocol of either master slave half duplex polled or peer to peer full duplex unpolled For a stand alone link to a computer you may want to use the peer to peer communication protocol for maximum speed However you may want to use the master slave communication protocol so that the computer can select the times it will spend communication through the link You can select a master slave communication protocol for any link to a computer You can select a peer to peer communication protocol only for a point to point link or a broadband MODEM multi drop link to a computer You can connect two Series B 1771 KG modules together to provide two
125. into acoustic couplers to connect the link DTE Controlled Answer These unattended MODEMS are directly connected to the phone lines The module as the data terminal equipment controls the MODEM via the DTR data set ready DSR and data carrier detect DCD signals The module uses timeouts and tests to properly operate these types of MODEMS Auto Answer These MODEMS have self contained timeouts and tests and can connect and disconnect the phone line automatically The module has no means to control an auto dial MODEM although it is possible for you to use it in conjunction with a separate auto dialer To Communication Module To provide a longline RS 232 C communication link with a 1771 KE KF module or another 1771 KG module refer to Figure 4 12 To provide a longline RS 232 C communication link with a 1773 KA or 1775 KA module refer to Figure 4 13 Assemble your own cable as shown in the wiring diagram Use Belden 8723 or equivalent cable which you can purchase from Allen Bradley using Cat No 1778 CR Connect the shield at one end only Use a 15 pin male connector on the 1771 KG module end Use a 15 pin or 25 pin male connector on the other end as required You can purchase a 25 pin male connector kit Cat No 1770 XXP from Allen Bradley Chapter 4 Installation The cable length is limited to 7 000 feet If you select a communication rate greater than 2 400 bits s the cable length is further limited Table 4
126. inuous Global Poll Normal Priority Only Single Station Poll High or Normal Priority 3 11 Chapter 3 Communication Concepts 3 12 High priority polling sequences consist of high priority polls Normal priority sequences contain only normal priority polls Before starting a non global normal priority sequence the master station uses a single global high priority poll to determine whether any station has a high priority message to transmit The global poll encompasses all stations on the link A descending binary search narrows in on a station any time a response to a group poll is detected At each step the group selected by the previous poll is divided into two halves and the first half is polled If there is a response that half is selected for the the next poll otherwise the half that wasn t polled is selected This continues until the last group is divided into two groups of one each and either The first station responds and mastership is transferred The second station responds and mastership is transferred Neither station responds and the master starts continuous polling After a station enters the polling state but before it starts a global poll it uses an ascending binary search to check the stations having addresses immediately higher than itself The station with the address of CM 1 current master plus 1 is polled first then CM 1 through CM 3 CM 1 through CM 7 and so on in group sizes of 1
127. invalid characters at the receiver The result 1s that the receiver changes its last response to NAK and the transmitter retransmits the original message packet Figure 6 12 Message Transfer with Retransmission SOURCE XMTR LINK RCVR SINK XXX DLE STX xxx DLE EXT BCC gt Not Full XXXX DL CK 222 gt Timeout DLE ENQ gt DLE NAK DLE STX xxxx DLE EXT BCC gt Message Discardedll DLE ACK OK Note that this is detected as a duplicate message 11564 Chapter 6 Communication Protocol Figure 6 13 shows a DLE NAK response to the initial message transmission because the message sink is full After the message sink is no longer full a retransmission of the message causes a DLE ACK response Figure 6 13 Message Transfer with Message Sink Full SOURCE XMTR LINK RCVR SINK XXXX gt DLE STX xxxx DLE EXT BCC gt lt Full DLE NAK DLE STX xxxx DLE ETX BCC Full _ DLE ACK DLE STX xxx DLE EXT BCC gt Not Full XXXX DLE ACK OK 11565 6 21 Chapter 6 Communication Protocol 6 22 Examples If you were to connect a line monitor to the wires between Station A and B and only the A to B subsystem were active you could observe the following Normal Message
128. ion is interpreted as a special code Word 027 is reserved for special functions such as this and cannot be used for other data table use The header rung defines the start of the communication zone It must consist of three GET instructions and a latch 02707 instruction Figure 5 2 Figure 5 2 Header Rung Address of Error Word Local Timeout Station No Preset Code Message Attempt i J Code 011 077 015 017 027 6 18 318 316 L 11542 5 3 Chapter 5 PC Programming 5 4 The three GET instructions in the header rung specify the following Local Station Number Address of the Error Word Timeout Preset Code The local station number must match the three digit number you selected with the station number switches on the 1771 KG module This number must be an octal number from 010g to 077g or from 110g to 376g Select any available word in the data table as the error word The 1771 KG module will write error codes into the word you select see Error Word The timeout preset code gives a programmed timeout interval for command completion Based on the three digit value entered in the address field of this GET instruction 1771 KG module monitors command execution for all commands sent from the local station In the examples of this publication we use 015 as the timeout preset code This value which designates a five second timeout preset is suitable for most applications The significance of th
129. is controlled to match the ON OFF status of the input Because the input and the compare bit are programmed to have matching states both ON or both OFF the conditions of Rung 1 can be true only when the input has just changed from ON to OFF or from OFF to ON Thus Rung 1 conditions set up a one shot true only long enough to latch the transition bit Note that these rung conditions are false as soon as the processor scans Rung 2 The order of these rungs is important for this reason With the transition bit latched the start bit in turn is latched in Rung 3 This initiates the command In normal operation the done bit unlatches the start bit in Rung 4 and then unlatches the transition bit in Rung 5 In faulted operation however Rungs 3 and 4 repeatedly retry the command in much the same manner as in the example of Figure 5 14 Timed You can latch the start bit periodically to send a command at a user determined interval Figure 5 16 shows example rungs for this type of command initiation In this example Timed Bit 04615 is used to initiate the command at every preset interval 10 seconds This bit is examined to latch the start bit The done local fault and remote fault bits are examined in parallel branches to unlatch the start bit In normal operation after the command is executed the done bit is set ON by the module This causes the program to unlatch the start bit The timer then begins timing again once the done bit is OFF
130. is instance until the fault situation was corrected You can use several programming methods to detect such a condition the simplest of these methods uses an on delay timer Figure 5 21 shows typical rungs that you can program for this purpose In the first rung of this figure Timer 060 times the interval between the setting of the start bit for a command and the done local fault or remote fault response of the module If no response is received within the preset interval of this timer here 10 seconds a fault may be indicated and Bit 06015 set ON The second rung examines this bit to turn ON an annunciator Depending on the individual application you could also use this bit to enable or disable various parts of the program The preset value of this programmed TON instruction is not critical For this type of backup monitoring the programmed preset must exceed the timeout preset interval entered as a code in the header rung Remember that the automatic timeout of the module gives a local fault response to a command which would indicate normal module processor communication but faulted communication with some other station Chapter 5 PC Programming Figure 5 21 Typical User Programmed Timeout Start Done 032 032 060 jt TE TON 12 02 0 1 Remote Fault 032 Jf PR 100 AC 000 12 Local Fault 033 dr 02 Output Timed Bit Indicator 060 010 Tue jo 15 02 11553 As with automatic timeout prese
131. is preset code its computation and timeout considerations are described later in Timeout Preset Value Memory Access Rungs Memory access rungs define data table words which can be accessed by the following commands from a remote station Protected Block Write Protected Bit Write Protected commands received from a remote station may control only those memory areas in the local station processor that are listed in memory access rungs Without memory access rungs the local station will not accept protected commands from a remote station A memory access rung is composed of one or more memory access branches as shown in Figure 5 3 A In this format a branch start precedes a group of three GET instructions The first get instruction address 1s the station number of a remote station The next two GET addresses define the word boundaries of the accessible data table area in the local station processor The specified remote station may control any bit or word within these boundaries through protected commands Chapter 5 PC Programming Figure 5 3 B shows the memory area that is now accessible to protected commands from Remote Station 010 due to the memory access branch of Figure 5 3 A Figure 5 3 Memory Access Example A Memory Access Branch B Local Station Processor Data Table Memory Access Boundaries in Local Station Data Table hk Aff Area Accessible P7 pF to Protected Commands from 7 Station No 010
132. is transmitting a message the module will interrupt its message transmission long enough to transmit its acknowledgment of the received message Disabled If the module receives a message transmission which ends while the module is transmitting a message the module will complete its message transmission before transmitting its acknowledgment of the received message Enabling embedded responses allows the most efficient use of the communication line However it applies only if you select the full duplex protocol Station Number Select the station number through Switch Assemblies SW 3 SW 4 and SW 5 Set the switches as indicated in Figure 4 4 Select a number from 10 to 77g or 110 to 376g To minimize Data Highway link polling time select station numbers that are close together If the 1771 KG module is linked to a communication controller module they are each part of the same Data Highway station and you must therefore assign each the same station number 4 7 Chapter 4 Installation SW 3 o1 2 N o F F Digit ye x 0 OFF OFF 1 OFF ON 2 ON OFF 3 ON ON Keying 4 8 Most Significant If you use the 1771 KG module in a stand alone link assign it a different station number from the other stations in the link Figure 4 4 Station Number Switch Settings SW 4 SW 5 O1
133. ivisible sequence of one or more bytes having a specific meaning to the protocol Indivisible means that the component bytes of a code must be sent one after another with no other bytes between them It does not refer to the timing of the bytes Full duplex protocol uses these codes Control Codes DLE STX DLE ETX BCC CRC DLE ACK DLE NAK DLE ENQ 6 3 Chapter 6 Communication Protocol 64 Link Layer Data Codes Data single bytes having values 00 OF and 11 FF hex DLE DLE to represent the value 10 hex We can also group codes into two classes according to their use codes issued from a station transmitting a message and response codes issued from a station receiving a message By this classification the full duplex codes are Codes from Station Transmitting a Message DLESTX Indicates the start of a message packet Link Layer Data 00 0F and 11 FF hex Encodes the bytes of the network packet DLE DLE Encodes the value 10 hex in the network packet This is necessary to distinguish a text code of 10 hex from a DLE control code of 10 hex DLE ETX BCC CRC Terminates a message packet DLE ENQ Requests the retransmission of the last received transmission Response Code from Station Receiving a Message DLE ACK Signals that the receiver has successfully received the last message sent DLENAK Signals that the receiver did not succes
134. k Each station must have a receiver connected to the circuit and transmitter that can be enabled or disabled by request to send You must program a computer to serve as a master that controls which station has access to the link All other stations are slaves and must wait for permission from the master before transmitting Each slave station has a unique station number from ten to 77 and 110 to 376 octal The number 377 is a broadcast address When the master sends a message addressed to 377 all slaves receive it The master can send and receive messages to and from each station on the multi drop link If the master is programmed to relay messages then 6 23 Chapter 6 Communication Protocol 6 24 slave stations on the multi drop link can engage in peer to peer communication Your multi drop link may be either a two circuit system master sends and slaves receive on one circuit slaves send and master receives on the other or a one circuit system master and slaves send and receive on the same circuit You may use a half duplex dial up modem to connect the 1771 KG module to the multi drop link The modem must signal data carrier detect at least once every 8 seconds If it does not the module will hang up You cannot use multiple masters unless one master is limited to acting as a backup to the other and does not communicate until the primary is shut down Transmission Codes Half duplex protocol is a character oriented p
135. k Packet Fields 6 43 Number Systems _C 1 O Octal _C 5 Operation Start Up 7 14 Options Switch Settings 4 3 Order of Transmission _C 6 P Paired Testing 7 14 PC Programming 2 3 5 1 PC Processor Data Highway Interface 2 1 PC Processor RS 232 C Interface 2 1 PC to Computer 2 5 PC to PC 2 4 Physical Addressing C 10 Physical Read 6 56 Physical Write 6 57 Polling 3 10 Polling Selection 3 11 Polling Sequence 3 11 Power Up Start Up 7 15 POWER UP Subroutine _D 18 Priority 3 2 Program and Message Types 6 41 Programming the Preset Code 5 32 Protected Bit Write 6 57 Protected Block Write 6 58 Protected Unprotected 5 36 R Read Commands 3 3 Receiver Actions 6 15 Remote Local Fault Bit Monitoring 5 27 Remote Local Fault Bits 7 6 Remote Local Fault Indicator ON 7 20 Remote Local Fault Word 5 13 Removing the Module 7 22 Retry Delay 5 26 RS 232 C Port 4 20 S Set Data Table Size 6 58 Set ENQs 6 59 Set NAKs 6 59 Set Timeout 6 60 Set Variables _6 60 Setting the Start Bit 7 16 SLEEP Subroutine _D 17 Specifications _1 5 Stand Alone Links 2 4 Start Up and Troubleshooting 7 1 Start Up Procedures 7 13 Start Done Word 5 12 Start Done Fault Bit Timing 5 18 Station Number Switch Settings 4 7 Stations 2 2 Status Words 5 11 STS Low Nibble 6 44 A 2 Switch Settings 4 1 Synchronizing Fault Bits 5 31 T Test Rungs 7 8
136. ket The master station transmits both polling packets and master message packets while slave stations transmit slave message packets Figure 6 14 illustrates the formats of these packets Note that the slave message packet has the same format as the full duplex message packet see Link Layer Message Packets The master message packet is the same as the slave message packet except that it is prefixed with DLE SOH and an address code to specify a slave station number At the end of each polling packet is a BCC byte At the end of each message packet is either a one byte BCC or two byte CRC field With a Series A module you must use BCC With a Series B module you can select BCC or CRC through switch settings Chapter 4 Chapter 6 Communication Protocol Figure 6 14 Formats for Half Duplex Protocol DLE ENQ STN BCC a Polling Packet From CMD STS FNC ADDR DATA Application Layer N N N N N From Data DST SRC CMD STS Pi From Application Layer eun Sy den zd we N p di s N pd v P Data BCC DLE STX From Network Layer DLE ETX orc b Slave Message Link Packet From CMD STS FNC ADDR DATA Application Layer Data From DST SRC CMD STS ma From Application Layer ea a SS se E b e S Pd
137. l 6 1 Detailed Flowcharts D 1 Diagnostic Counters 7 6 B 1 Diagnostic Counters Reset 6 51 Diagnostic Fault Rungs 5 28 Diagnostic Loop 6 51 Diagnostic Read 6 52 Diagnostic Status 6 52 Diagnostics 3 4 Document Organization 1 1 Done Bits 5 12 5 18 Download 6 62 DST and SRC 6 44 E Embedded Response Option 6 22 Enter Download Mode 6 55 Enter Upload Mode 6 55 Error Checking 3 6 Error Reporting _A 1 Error Word 5 15 7 6 A 2 Examine Start Bit 5 8 Exit Upload Download Mode 6 56 F Faulted Operation _5 20 Floating Master 3 8 FNC and CMD 6 46 Index Force On Function 7 6 Full Duplex Protocol 6 2 Full Duplex Protocol Diagrams 6 19 H Half Duplex Protocol 6 23 Half Duplex Protocol Diagrams 6 35 Header Delimiter Rungs 5 3 Hexadecimal C 4 Indicators 7 4 Installation 4 1 Installing the Replacement Module 7 23 K Keying 4 8 L Link Layer Protocol on Data Highway Link 3 8 Link Layer Message Packets 6 4 Link Layer Packets 6 26 Logical Addressing C 9 M Master Polling Responsibilities 6 31 Memory Access Limitations 5 36 Memory Access Rungs 5 4 Message Characteristics 6 31 Message Structures 3 1 Message Transmission 3 9 Mode Select Commands 3 4 Module Insertion 4 9 Module Replacement 7 22 Monitoring Remote Local Fault Bits 7 18 Multi Drop Link 6 23 Necessary Documentation 7 11 Network Layer 6 41 Network Model 6 42 Networ
138. le turns ON the done bit Note that input bit 11111 must also be OFF to Chapter 5 PC Programming 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 5 12 that the module holds the done bit ON until after the start bit is turned OFF Figure 5 14 Status Initiated Command Remote Local Input Fault Fault Start 111 033 033 032 H F L 11 12 02 12 Done Input Start 032 111 032 PE F U 02 11 12 Local Fault 033 t 02 Remote Fault 033 J L J L 12 11547 Should a fault condition prevent normal execution these rungs provide a programmed retry of the command as long as Bit 11111 is ON 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 module resets the fault bit As Figure 5 13 shows the module resets a fault bit only after the start bit has been turned OFF Even though the fault bits are continually reset with this method their usefulness must not be overlooked Remote Local Fault Bit Monitoring which follows outlines a useful method to monitor fault bits and control an output indicator based on fault bit status In some applications it may be use
139. leted The 1771 KG module writes a code in the 80 99 group whenever a remote or local fault bit is set ON The upper byte of the error code storage word Bits 10 17 stores a two digit BCD value This value gives supplemental error or fault information depending on the type of error code displayed This value may have one of two meanings a Reference Number Counter For Error Codes 01 29 the upper byte stores a two digit reference number This number points to the location of a programming error within the communication zone of the program This error may be an incorrect instruction or an improper address entered within a rung of the communication zone In this numbering scheme the header rung is designated as 00 Subsequent communication zone rungs are numbered sequentially Note that Error Codes 01 29 are intended as aids in start up debugging of the communication zone Thus the reference number stored in this word can be a valuable tool for debugging purposes For Error Codes 30 99 the upper byte stores a two digit counter This counter shows the number of Error Codes 30 99 written into the storage word by the 1771 KG module The counter increments each time the module enters a different error code Because Codes 01 29 are intended for start up situations and Codes 30 99 are intended for situations subsequent to power up there is no conflict in controlling this upper byte of the error code storage word Chapter 5 PC Pro
140. lowing Number of the Remote Station to Which the Command Is to Be Sent Priority Status of the Command High or Normal Type of Command The command code uses the address of an EXAMINE ON instruction but does not examine or control any bit in the data table of the local station processor Figure 5 5 Block Command Format When you enter a command code specifying a protected block write unprotected block read or unprotected block write command use the format shown in Figure 5 6 This format uses three GET statements Use the address of the first GET statement to specify a remote station data table word The specified command operation begins at this address Use the second and third GET statement addresses to define the start and end of a block of data table words in the local station processor This block contains words to be transferred in the write or read operation Chapter 5 PC Programming In the block write operation data words are written to a remote station from the local station data table The first GET element in the command rung specifies a beginning address at the remote station Data is to be written into this word and succeeding words from the local station data table The second and third GET elements in this type of rung list the starting and ending boundary for the word or words to be sent from the local station data table In the block read operation data words are read from a remote station into th
141. ly information Submit the packet to the network Destroy the command packet Application programs communicate by sending information back and forth in the command status and data fields of network packets Application protocols may vary depending on the types of application programs that are communicating Application Message Fields Figure 6 26 shows the general format of the application fields for a command message Not all command messages have FNC ADDR or DATA bytes Figure 6 27 shows the general format of the application fields for a reply message Not all reply messages have DATA bytes CMD and FNC The low nibble of the CMD command byte and the FNC function byte define the type of action to be performed by the command executor at the destination station for these message formats which include an FNC byte The CMD byte alone defines the type of action to be performed by the command executor at the destination station for those message formats which do not include an FNC byte For each of the types of messages that can be transmitted across this link the hexadecimal values of the CMD and FNC bytes are listed in Chapter 6 Communication Protocol Table 6 C Hexadecimal Values of CMD and FNC Bytes Command Message Command CMD FNC CMD Diagnostic Counter Reset 06 07 46 Diagnostic Loop 06 00 46 Diagnostic Read 06 01 46 Diagnostic Status 06 03 46 Enter Download Mode 07 04 47 Enter Upload Model 07 06 47
142. mand writes a block of data into any area of PC data table memory Command Format 08 00 Reply Format 48 Several PLC 2 program scans may go by while the entire block is written into the data table Therefore it is generally good practice to buffer the data in one area and to allow the program to move it to the data table area where it is to be used only after the operation is complete A common application for a 1771 KG module is to conduct data between programmable controllers and computers Their massive storage capacities make computers ideal places to deposit and store entire master programs Master programs are copied from controllers to computers upload and from computers to controllers download You can use those masters to verify programs as the PCs run them In an upload the user accessible memory from the PC can be copied to the bulk storage device in a computer In a download the user accessible PC memory can be copied from the bulk storage device to the PC memory The upload and download procedures which we describe here use commands which are available on the Series B module only Download Since the program is replaced in a download operation and this replacement may take several seconds the PC must be stopped during the download so that it does not try to execute a program that is changing Chapter 6 Communication Protocol The data table is usually changed during a download so that 1771 KG mod
143. message transfer is complete After signaling the message source that the message has been sent successfully Transmitter A proceeds with the next message If Transmitter A gets a DLE NAK it retransmits the same message The transmitter restarts the timeout and waits again for a response By using the diagnostic set NAKs command see Set NAKs you can specify how many times the 1771 KG module will attempt to retransmit a given message The default setting is three Once the number of retransmissions exceeds this limit the transmitter should notify the message source that the transmission has failed The transmitter can then proceed with the next message 6 11 Chapter 6 Communication Protocol 6 12 If the timeout expires before Transmitter A gets a response it sends a DLE ENQ on Path 1 to request a retransmission of the last response sent on Path 2 Transmitter A restarts the timeout and waits for a response By using the diagnostic set ENQs command see Set ENQs you can specify how many timeout periods the 1771 KG module will allow per message it transmits The default setting is ten If this ENQ limit is exceeded the transmitter should notify the message source that the transmission has failed The transmitter can then proceed with the next message DLE ACK and DLE NAK are the only response codes defined If the receiver gets an invalid response code it should ignore it Note that the transmitter must encode a text
144. mode While in the download mode the module writes an end of program instruction in the first word of the program This end instruction keeps the PC processor from executing the program until the download mode is exited If the 1771 KG module cannot complete a download the end instruction is left as the first word of the program For the enter download mode command to be accepted by the 1771 KG module connected to a PLC 2 15 or PLC 2 30 processor the mode select switch must be in the RUN PROG or PROG position The mode select switch of a PLC 2 20 or Mini PLC 2 processor can be in any position 6 63 Chapter 6 Communication Protocol however we recommend that you select the PROG position Results of the enter download mode command are The PC program scan will be inhibited Series B module only The industrial terminal will be disabled A PLC 2 15 or PLC 2 30 processor will be put into the program load mode Series B only with the last state switch at each I O chassis set to OFF the outputs will be disabled Series B module only the outputs of a PLC 2 20 or Mini PLC 2 processor or PLC 2 15 or PLC 2 30 processor with a Series A 1771 KG module will remain enabled if the mode select switch is in the RUN or RUN PROG position WARNING Leaving outputs on during a download could cause unexpected machine motion If you send an enter download mode command to a 1771 KG module connected to a PLC 2 20 or Mini PLC 2 processor
145. n a nominal value of 5 seconds coded 015 is programmed as the timeout preset value This value is appropriate for most applications Programming the Preset Code You enter the timeout preset code in the Header rung of the communication zone of program The address field of the third GET instruction in this rung is used for the timeout preset code Figure 5 20 shows the position of this rung element Figure 5 20 Timeout Preset Significance Header Rung Code Representation aag eal L X37 Code 37 Entered Time Preset Interval if Timeout Occurs Within This Period Done or Fault Bit Expected Done Bit ON OFF Remote ON Fault Bit OFF Local Fault Bit Local ON Set if Timeout Occurs Fault Bit OFF A Time 11320 5 32 Chapter 5 PC Programming The address of a GET instruction is an octal number Because only octal values can be entered in this address field the timeout preset value is a code computed as outlined in this section The timeout preset is not a critical value For most applications a five second preset is acceptable The code for the timeout preset is 015 This code is used in all header rungs shown in this publication However there may be instances where another timeout preset interval is desired Table 5 B lists the three digit codes for intervals from 2 to 10 seconds The tolerance of this timer is 0 and 1 second Table 5 B Timeout
146. n a Mini PLC 2 15 processor the module rejects any write command addressing words above 177g regardless of this selection Also with the memory write protect jumper removed from a PLC 2 30 processor the module rejects any write command addressing words above 377g regardless of this selection Parity The parity selections are Even Parity The module transmits and accepts characters made up of a start bit eight data bits an even parity bit and a stop bit Note that you cannot select even parity if you select CRC for the error check selection None The module transmits and accepts characters made up of a start bit eight data bits no parity bit and a stop bit Chapter 4 Installation Error Check The error check selections are BCC The module transmits and accepts packets which end with a BCC byte for error checking CRC The module transmits and accepts packets which end with a two byte CRC field for error checking When deciding whether to use BCC or CRC consider the following CRC provides more complete error checking BCC is easier to implement in the computer driver and provides adequate error checking for most applications For communicating with another Series B 1771 KG module you must make the same selection at both modules Embedded Response The embedded response selections are Enabled If the module receives a message transmission which ends while the module
147. n an RS 232 C link The sending station appends the CRC to the packet based on the bit pattern of the transmitted data field The sending station computes a CRC based on the received data and checks this against the CRC value included with the message A discrepancy between the transmitted CRC and the CRC computed by the receiving station indicates some fault in the transmission If the received and computed CRC values do not agree the message is not accepted as valid 3 7 Chapter 3 Communication Concepts Link Layer Protocol on Data Highway Link 3 8 The link layer protocol used between stations on the Data Highway link is a modified low level implementation of HDLC that features bit stuffing flag definition and the generation of the CRC This protocol is completely transparent to the user However it is discussed here in general to help you understand the choices you must make before installing and operating your network Floating Master Central to the interaction of communication modules on the Data Highway link is the concept of the floating master With this arrangement no single station is permanent master controlling the Data Highway communication link at all times Instead each station bids for mastership based on its need to send command or reply messages This arrangement has two major features Multiple Masters Peer to Peer Communication One advantage of floating master operation is that no single sta
148. n be invalid The DLE SOH DLE STX or DLE ETX BCC may be missing The message can be too long or too short A spurious control or data code can occur outside a message A spurious control code can occur inside a message Any combination of the above can occur The DLE ACK response can be lost causing the transceiver to send a duplicate copy of a message that has already been passed to the message sink Each slave station is in a passive mode until it receives a DLE SOH or DLE SOH code While in a passive mode a slave ignores any transmission code that is not DLE ENQ or DLE SOH When a slave receives a DLE SOH it resets its BCC accumulator and message receiving buffer The next code it receives must be its specific station number or the global Station Number 377 octal If the packet does not contain the appropriate station number the slave ignores it and waits for the start of a new transmission If a slave receives a message packet with the appropriate station number it adds the value of that station number to its accumulated BCC If the next characters after the station number are DLE STX then the slave transceiver starts storing the incoming link layer data in a buffer The transceiver stores all data codes in the buffer and adds these code values to the accumulated BCC Even if the storage buffer overflows the transceiver continues summing the BCC while discarding the data The slave also sets an error flag to in
149. n of the corresponding command It is up to the local application program to display and act on the value of the returned byte In PLC 2 family processors the value of the byte is interpreted by the processor and then displayed in an error word Data Security There are two checks used in message transmission An 8 Bit Block Check Character BCC A 16 Bit Cyclic Redundancy Check CRC Some station interface modules also let you select a parity check even parity only Chapter 3 Communication Concepts Block Check Character BCC You can use a block check to detect errors on an RS 232 C link Any device connected to that link must be capable of generating a BCC The sending station adds a BCC to the end of every link packet to help detect errors of transmission within the module The sending station generates the BCC by first summing every byte of the data field excluding control characters then taking the 2 s complement of that sum The result is the BCC Notice that any final carry out is ignored in the BCC computations The receiving station also sums the data field bytes then adds that sum to the BCC to produce 00000000 Any sum other than 00000000 indicates an error has been made in the transmission and causes the receiving station to respond with DLE NAK Cyclic Redundancy Check CRC The CRC is used to validate packets transmitted on the Data Highway link With the Series B 1771 KG module you can use a CRC o
150. n the processor is switched from the program mode to the run or test mode It also checks these rungs after executing an exit download upload mode command or when the cable to the processor is reconnected If the module finds a valid header rung during this initializing procedure the PROG indicator turns ON After the module has checked these communication zone rungs and if it has found no errors in programming format for these rungs the module turns the PROG indicator OFF However should any programming error be detected in the communication zone of program this indicator remains ON In this event you can check the error code storage word for an indication of the problem Refer to Start Up Procedures which appears later in this chapter Should the PROG indicator fail to turn ON momentarily at power up or when the mode select switch is turned from program load mode the switch selected station number may not match the station number in the header rung of the communication zone of the program or there may be some other error in the header rung PROC Processor Status This red indicator will go ON when a processor is not connected to the module The processor status indicator is normally OFF It flashes once for every retry due to a communication error between the 1771 KG module and the processor Should the PROC indicator go ON one of the following problems may have occurred Disconnection of the cable which connects the
151. n the processor mode select switch to the TEST position 5 Position the cursor on the EXAMINE ON instruction of Rung 1 6 Onthe programming terminal press the key sequence for the FORCE ON function FORCE ON INSERT The start bit is now forced ON Under normal operation this bit is being set and reset as the processor executes its scan and the command is sent continuously With the start bit turned ON in this fashion proceed to Step 2 of the next section Once these checks have been completed you can enter the next start done bit addresses in the test rung for testing of the next command Chapter 7 Start Up and Troubleshooting 7 18 You can remove the FORCE ON function using the industrial terminal On the industrial terminal position the cursor on the forced instruction and press the following keys FORCE ON REMOVE The FORCE ON function is also removed when you disconnect the industrial terminal from the 1771 KG module or the 1771 KG module from the processor or when the module receives an enter upload or enter download command Monitoring Remote Local Fault Bits This second step in command checking requires that you monitor the fault bits Use the following steps to observe the instructions which examine fault bits 1 Turn the processor mode select switch to TEST position 2 Use the search functions of the industrial terminal to locate instructions which examine fault bits Search functions are d
152. nal procedures are available for start up and troubleshooting Among these added capabilities a set of diagnostic commands is available Even if a Data Highway network includes a computer follow the procedures of this chapter for initial testing of the station Once you have tested each station containing a programmable controller you can then check operation of the computer interfacing This section describes the tools which are available for start up and troubleshooting personnel These aids are provided by 1771 KG Module Industrial Terminal Documentation Provided by the Programmer of the Station Processor Module Indicators Module diagnostic indicators show the status of module operation with its station processor This paragraph describes these indicators and their significance in start up and troubleshooting Figure 7 1 shows the significance of various combinations of energized indicators Note that the three green indicators show module status in normal message transfer The two red indicators show the status of module tests of the program and 1771 KG module communication with its station processor 7 1 Chapter 7 Start Up and Troubleshooting Figure 7 1 Module Indicator Combinations Transmitting a Receiving a RS 232 C Station Add
153. nd station number switch selection is correct and that data is being sent to the intended station When a command has been initiated and tested at its sending station perform the following procedures at the receiving station 1 On the programming terminal at that receiving station display the instructions for the application program which are affected by data transferred from the sending station To identify areas of the program which are affected by transferred data refer to Form 5033 which is recommended programmer documentation for each station 2 Check that the data at these locations matches the data in the proper locations at the sending station processor For write or read commands observe instructions which address transferred words in the program at the receiving station processor These instructions include GET PUT TON TOF RTO CTU and CTD For bit write commands check the ON OFF status at instructions which examine those bits in the program 7 19 Chapter 7 Start Up and Troubleshooting Troubleshooting For troubleshooting you can use the same tools and procedures you used in start up of a station containing a 1771 KG module This section outlines procedures you can use in addition to the start up procedures in Start Up Procedures Remote Local Fault Indicator ON As recommended in Chapter 5 you should control some indicators by the status of the remote and local fault bits at each station proce
154. ned as initialize NAK limit and ENQ limit SEND Message start timeout loop WAIT for response on Path 2 or timeout if received DLE ACK then return SUCCESS else if received DLE NAK then begin if NAK limit is exceeded then return FAILURE else begin count NAK retries SEND MESSAGE Message start timeout end end else if timeout begin if ENQ limit is exceeded then return FAILURE else begin count ENQ retries send DLE ENQ on Path 1 start timeout end end end loop SEND Message is defined as begin BCC 0 send DLE STX on Path 1 for every byte in the message do begin add the byte to the BCC send the corresponding data code on Path 1 end send DLE ETX BCC on Path 1 end GET MESSAGE TO SEND This is an operating system dependent interface routine that waits and allows the rest of the system to run until the message source has supplied a message to be sent SIGNAL RESULTS This is an implementation dependent routine that tells the message source of the results of the attempted message transfer WAIT This is an operating system dependent routine that waits for any of several events to occur while allowing other parts of the system to run 6 14 Chapter 6 Communication Protocol Receiver Actions Since the receiver gets dirty input from the physical world it is more complex and must be capable of responding to many adverse situations Some of the things that can conceivably happen are listed here The
155. ned in branches of Rung 3 parallel to those shown Of course other methods can be used to monitor remote and local fault bits Such factors as availability of output terminals memory space and type of application dictate the specifics of fault bit monitoring and program response Chapter 5 PC Programming The use of fault bits in start up and troubleshooting procedures is described in Chapter 7 Synchronizing Fault Bits As noted earlier the 1771 KG module s scan and its control of the fault and done bits is asynchronous to the PC processor s scan and its control of the start bits In the examples discussed so far as in most applications this lack of synchronization does not present any problems However you may want to use the PC program to count the number of times a fault bit turns ON and or to store the error code each time a fault bit turns ON Because of the asynchronous relationship you may not be able to do these types of functions accurately by examining fault bits directly Instead of examining the fault bits directly use a GET PUT rung at the beginning of the program to copy the fault word into another word You can then examine the corresponding bits of the other word any time during the program scan to determine the status of the fault bits as copied at the beginning of the program scan Even though the 1771 KG module may change the state of fault bits in the middle of a program scan the status of the bits
156. nerated using an RS 232 C compatible printer connected through an industrial terminal 7 11 Chapter 7 Start Up and Troubleshooting Figure 7 6 Switch Setting Record for 1771 KG Module Instructions Use a Pencil to Date Darken Switches to Show Proper Settings as Shown Keep This By Form Where It Can Be Easily Referenced ON Station No Example OFF Station No SW 1 SW 2 SW 3 SW 4 SW 5 O1 2 3 012 345 O1 2 O01 2 3 012 3 N N N N N O Oo 0 O F F F F F Communi rane x Digit Digit ra ia Digit 110 OFF OFF OFF 0 OFF OFF 0 OFF OFF OFF 0 OFF OFF OFF 300 ON OFF OFF 1 OFF ON 1 OFF OFF ON 1 OFF OFF ON 600 OFF ON OFF 2 ON OFF 2 OFF ON OFF 3 OFF ON ON 1200 ON ON OFF 3 ON ON 3 OFF ON ON 4 ON OFF OFF 2400 OFF OFF ON 4 ON OFF OFF 5 ON OFF ON 4800 ON OFF ON Most Significant 5 ON OFF ON 6 ON ON OFF 9600 OFF ON ON 6 ON ON OFF 7 ON ON ON 19200 ON ON ON 7 ON ON ON Least Significant First Second Module N First Module OFF Second Module Accept Physical Unprotected Writes
157. ng Any accessible data table words may be used as status words in the station processor Figure 5 8 User Selected Status Words Local Station Data Table Wf Start Done Word Remote Local Fault Word Oo Error Word 8 PECET amiy Interface Module Q 9 nr NOTE Start Done and Remote Local Fault words must be adjacent Use one pair for each group of up to 8 commands 11314 5 11 Chapter 5 PC Programming Start Done Word The start done word is the first of a pair of adjacent status words for module use This word stores a start bit and corresponding done bit for each of up to 8 commands NOTE Should more than 8 command rungs be programmed at a station additional pairs of start done and remote local fault words must be used Select the start bit for any command in the upper byte Bits 10 17 of the start done word The done bit for this command is then the corresponding bit in the lower byte Bits 00 07 of the same word In Figure 5 9 A the sample command rung examines Bit 03210 as its start bit As Figure 5 9 B shows the corresponding done bit is Bit 03200 Note that the address of start done bits for each command differs only in the next to last digit the start bit always has a one 1 in the next to last digit the done bit always has a zero 0 Figure 5 9
158. ning ON the protocol switch Half duplex protocol is similar to full duplex in most respects Two major differences are Half duplex protocol provides for polling of slave stations Half duplex protocol does not allow embedded responses Half duplex protocol is for one master and one or more slaves You must use MODEMS for this type of link unless there is only one slave The 1771 KG module has slave mode capability only you must provide the master function through a computer Half duplex protocol provides a lower effective utilization of resources than full duplex but it is easier to implement You should use half duplex protocol if You are using multi drop baseband MODEMS to connect multiple slave stations to a single master computer You are using MODEMS that have only half duplex capability You are willing to sacrifice data throughput in exchange for ease of implementation Multi Drop Link One environment for half duplex protocol is a multi drop link with all stations interfaced through half duplex MODEMS The actual nature of the link does not matter much as long as the MODEMS support request to send clear to send and data carrier detect signals If you use dial up MODEMS they must also support data set ready and data terminal ready otherwise you should jumper data set ready to data terminal ready at the 1771 KG module You may have from two to 256 stations simultaneously connected to a single multi drop lin
159. nt is very important The testing of your application program at each station is essential for proper operation This means that you must test the application program before the network is tested You must test this program which controls output devices Include testing of those parts of the program which use data transferred from other stations In a new installation you must complete all start up procedures of the controller before attempting to test operation of the 1771 KG module These procedures include complete testing of I O devices I O wiring and program sequencing Procedures for start up of a new controller are covered in the installation and operation manual for the controller In many cases you are adding capability to an existing controller installation Here the application program may be only slightly modified to use data from other stations However you must test any change to the program at the controller so that you can correct errors before the program is put into full operation Again this testing is your responsibility 7 13 Chapter 7 Start Up and Troubleshooting Overall Approach In start up testing limit the number of things happening at one time By carefully limiting the scope of start up testing to a small number of variables you can more readily detect the source of a problem Paired Testing Do start up testing with two stations communicating After comprehensive testing of both stations place t
160. o left bit order as in Zilog Z 8000 or Motorola 68000 micro processors If your computer has this type of word order your communication driver must handle the task of byte swapping as it loads data into a buffer Successive bytes received from the PC must be stored in the following order 1 0 3 2 5 4 7 6 9 8 Figure C 6 Result of Transmitting Low Byte First A PC Word 17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00 Bit Number Value Octal As76Hex 5119011 0 0 1 0 1 0 1 1 1 0 1 1 0 Odd High Byte Even Low Byte B 16 Bit Computer Word with Right to Left Byte and Bit Order 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 Bit Number Value Decimal As76Hex 511911 0 0 1 0 1 0 1 1 1 0 1 1 0 Odd High Byte Even Low Byte C 16 Bit Computer Word with Left to Right Byte and Bit Order 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 Bit Number Value Decimal A576 Hex HE 1 1 1 0 11 1 ee 0 1 0 0 1 0 b after Byte V V wapping Even High Byte Odd Low Byte D 16 Bit Computer Word with Left to Right Byte Order and Right to Left Bit Order 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 Bit Number Value Decimal A576 Hex 0 11 1 0 1 1 0 1 0 10 0 10 after Byte wapping Even High Byte Odd
161. octal number has a place value that is a multiple of eight To convert from octal to decimal multiply each octal digit by its corresponding place value and add the results of the multiplications Figure C 5 shows the octal representation of the decimal number 239 Figure C 5 Octal Numbers 12 1x2122 3s 1x209 1 1x22 24 0x2 20 58 1x 20 1 1x22 24 1x2122 78 1x2021 3x 8 192 5x8 2 40 1 1 1 0 11 1 1 7x8027 357g 23919 11336 Order of Transmission PCs store data in 16 bit two byte words The bits in these words are numbered addressed 0 through 17 octal going from right to left within a word as follows PC Word Bits 17 16 15 14 18 12 11 10 07 06 05 04 03 02 01 00 Appendix C Data Manipulation In PC memory the words are arranged as shown above However when the 1771 KG module transmits data over its RS 232 C link it transmits one byte at a time The 1771 KG module transmits the low byte Bits 00 through 07 of a word before the high byte Bits 10 through 17 of the same word Also the UART transmits the low bit first within a byte Thus when a PC word is traveling over the RS 232 C link it will look like this First Byte Second Byte Bits 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 Time gt gt This
162. ommunication Protocol SOURCE Although the protocols on each subsystem operate independently there is a slight delay when you transmit a response code in the middle of a stream of message codes Also any non transient hardware problem that affects message codes traveling over a hardware circuit affects response codes on the same circuit Protocol Environment Definition To fully define the protocol environment you must tell the transmitter where to get the messages it sends and tell the receiver what to do with the messages it receives You can do this in your network layer see Network Layer For purposes of discussion in this section these functions are called the message source and the message sink respectively We assume that the message source supplies one network packet at a time upon request from the transmitter and that it requires notification of the success or failure of the transfer to Station B before supplying the next When the message source is empty the transmitter waits in an inactive state until a message is available Whenever the receiver has received a link packet successfully it attempts to give the network packet portion to the message sink The message sink may be full The message sink must notify the receiver when it is full Figure 6 6 represents the protocol environment Figure 6 6 Protocol Environment Network Network Packet Path 1 Packet Transmitter Rec
163. on might report in its reply to a command message from the local station The remote station puts the error code in the STS byte of its reply message and the local station module copies this code into the error code storage word at the local processor The local module also sets a remote fault bit in the local processor s memory Reply Errors 50 thru 59 Relate to errors that the local module detects in reply messages it receives from other stations These include the timeout error Number 37 which occurs when the local station receives no reply message at all for one of its command messages A 1 Appendix A Error Reporting Error Word STS Byte A 2 The error word contains the last error code reported by the module whenever the local station transmits a command message to another station The first column in Table A A lists the possible error codes stored in this word Note that a code value of zero indicates no error has occurred Also note that some of the errors cause the module to set a local or a remote fault bit in the PC data table as indicated in the third and fourth columns of the table The error word contains a four digit BCD binary coded decimal number The lower byte of this word last two digits contains the last error code reported by the 1771 KG module The upper byte first two digits has one of two uses depending on the error code For Errors 01 26 It represents the rung number where the err
164. on No 023 11580 7 21 Chapter 7 Start Up and Troubleshooting 5 Use the search functions to locate the command rung which begins with the start bit as determined in the previous step 6 Examine the command code of this rung to determine the remote station to which the command was sent 7 Determine the nature of the faulted condition and correct this condition Use Figure 7 2 as a guide to tracing possible sources of a faulted condition 8 Verify that you corrected the fault condition Observe the fault indicator at the sending station Module Replacement After you have made other troubleshooting checks you may have to replace the module Removing the Module 1 Remove I O chassis power and processor power 2 Disconnect all cables connected to the module sockets 3 A plastic latch on the top of the chassis holds the module in place Pivot this latch upwards out of the way of the module 4 Lift up the plastic lever on the module to break its backplane connection 5 Firmly grasp the sides of the module and pull it from the I O chassis slot 7 22 Chapter 7 Start Up and Troubleshooting Installing the Replacement Module 1 Set module switches to match the switch settings of the module you are replacing Replace the switch cover 2 Insert the replacement module in to the I O chassis Snap down the latch on the top of the chassis and reconnect the cables to module sockets Module power u
165. or occurred within the communication zone of the ladder diagram program The first rung in the communication zone is Rung 00 and subsequent rungs are numbered sequentially For Errors 30 to 99 It represents a count of the different errors reported by the module This counter is incremented each time a different error occurs not each time the same error occurs Whenever a remote station transmits a command message to the 1771 KG module the module reports the status of that command in the STS byte of its corresponding reply message If the command station is another PC the status information is reported in the error word as explained in Error Word If the command station is a computer it is up to you to write computer application programs to monitor the STS byte in whatever way you see fit The second column of Table A A lists the possible STS codes in hexadecimal notation Note that an STS value of zero indicates no error has occurred Table A A Error Codes Low Byte of Error STS Byte of Reply Fault Bits Word in Hex Message in Hex Local Remote 00 00 Appendix A Error Reporting Meaning of Error Code No error Processor fault Module ran out of internal memory space This error can occur if the communication zone is too large Try using fewer communication zone rungs First GET instruction incorrectly entered in memory access rung Invalid station number used in a memory access rung Second GET instr
166. ot receive the command message If the remote station did receive the command the local module may still set a done bit when it receives the proper reply A 5 General Appendix Diagnostic Counters The module contains a set of internal counters that keep track of communication statistics such as the number of messages sent and received number of NAKs sent and received number of ACKs sent and received and timeout limits You can use this information to monitor the general efficiency of communication with the module s RS 232 C port Table B A lists the diagnostic counters for the 1771 KG module To monitor these counters from your computer station Send a diagnostic status command to the module to determine the starting address of the counter block The seventh and eighth data bytes of the module s reply to the diagnostic status command will contain this starting address Use a diagnostic read command to read the counter values which start at the address determined in Step 1 above and extend over 52 consecutive bytes of module memory For each counter Table B A lists the byte offset from the starting address of the block Table B A Diagnostic Counters 00 16 bit count of the number of times the station attempted to send a message 02 16 bit count of the number of messages that were successfully transmitted and ACKed 04 16 bit count of the number of ACKs that were received 06 Number of ACKs successfully passe
167. p is described in Power Up 7 23 General Appendix Error Reporting This appendix describes error reporting for communication with the module You can get error information from three sources The Error Word in the PC Ladder Diagram Program The STS Byte in a Reply Message The Diagnostic Counters in the 1771 KG Module Table A A lists the possible errors reported by the 1771 KG module We can group these errors into five classes Syntax Errors 1 thru 29 Relate to errors in programming communication zone rungs The module checks for these errors when you power it up and when you turn the processor mode select switch from PROGRAM to RUN If it detects a syntax error the module turns on its PROG indicator and shuts down Note that the module cannot detect errors in the header rung of the communication zone if the header rung is incorrect the module assumes that no communication zone exists Message Formatting Errors 30 thru 36 Relate to errors that the module detects when it attempts to format a command message but before it actually tries to transmit the message For some of these errors the module turns on its PROG indicator and shuts down Local Errors 90 thru 99 Relate to errors that the local station module detects as it tries to transmit a command message When one of these errors occurs the module sets a local fault bit in PC memory Remote Errors 80 thru 89 Relate to errors that a remote stati
168. passes from one station to another in a round robin fashion During installation you assign each station a unique number from 010 to 77g or 110g to 376g Each master passes mastership to the station with the next higher address that is requesting mastership All polling arithmetic is performed modulo 256 relative to the address of the current master That is mastership is offered to the station with the next higher of the 256 possible addresses when the highest address is reached it starts over at the lowest address For example when the master is 200 Station 220 will receive mastership before Station 30 since 220 is less than 30 relative to 200 Figure 3 2 illustrates this polling scheme Figure 3 2 Polling Scheme 013 074 2 075 011 076 010 077 110 375 ge 111 374 112 373 113 e e e e e e 303 174 302 175 301 176 300 iN P 4 177 277 200 276 201 275 202 2746 e e 203 11537 Chapter 3 Communication Concepts The polling algorithm recognizes two levels of message priority and gives preference to stations with high priority messages when selecting the new master This bypasses the normal round robin pattern and causes mastership to pass to the station with a high priority message and the next higher number than the previous master Stations with high priority messages pass mastership either to another station with high priority messages or to the station with normal priority messages that has the n
169. provides an option selection for the module Figure 4 3 A Parity The parity switch selections are ON The module transmits and accepts characters made up of a start bit eight data bits an even parity bit and a stop bit OFF The module transmits and accepts characters made up of a start bit eight data bits no parity bit and a stop bit Embedded Response The embedded response switch selections are ON If the module receives a message transmission which ends while the module is transmitting a message the module will interrupt its message transmission long enough to transmit its acknowledgment of the received message OFF If the module receives a message transmission which ends while the module is transmitting a message the module will complete its message transmission before transmitting its acknowledgment of the received message Enabling embedded responses allows the most efficient use of the communication link However it applies only if you set the protocol type switch to ON for full duplex 4 3 Chapter 4 Installation 4 4 Accept Unprotected Writes The accept unprotected writes switch selections are ON The module accepts unprotected write commands OFF The module rejects unprotected write commands Accept Physical Writes The accept physical writes switch selections are ON The module accepts physical write commands OFF The module rejects physical w
170. remote fault bit Recall that the start bit is program controlled The remote local fault bits meanwhile are module controlled You must keep this relationship in mind when planning START bit control and FAULT bit monitoring in the ladder diagram program Note from Figure 5 13 that the fault bit once ON remains ON until your program turns OFF the start bit Only after it has detected that the program controlled start bit is OFF does the 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 module sets a done or fault bit attempts to send that command are terminated The local fault bit is pulsed ON for approximately 100 ms in this instance This type of situation may occur for example if some event is programmed to unlatch the start bit before command completion Chapter 5 PC Programming Figure 5 13 START FAULT Bit Timing Faulted Operation Q Start Bit ON MMMM AKH 1771 KG alas ModuleScan Remote Time 7 or Local ON UL WM Fault Bit OFF pp unl pg Done Bit ON OFF LEGEND A Start Bit turned ON by the program B Remote Fault or Local Fault Bit set ON by the 1771 KG module to indicate that a Fault Condition has been detected C Start Bit turned OFF by the program D Fault Bit turned OFF by the 1771 KG module after it sen
171. res messages that do not contain the correct station number As part of the duplicate message detection algorithm the transceiver checks the second third fifth and sixth bytes of each network packet At least one of these bytes of the current network packet must differ from the corresponding byte of the previous network packet in order for the transceiver to act upon the current network packet Otherwise the transceiver assumes that the current network packet is a retransmission of the previous network packet so it discards the current network packet Master Polling Responsibilities You may vary the master polling algorithm depending on the how much activity you expect on your network The master should poll each slave repeatedly until the slave has transmitted all of its messages The master should then send any messages it has for that slave Then the master can poll the next slave in the same way If a slave station fails to respond to a poll the master should remove that slave from the list of active slaves To save time the master should poll only the active slaves on a regular basis The master should poll the inactive slaves occasionally to see whether they will respond It is best not to allow the master station s transceiver to relay messages directly from one slave station to another Instead the transceiver should funnel all received messages to the message sink network layer The network layer can then analyze the m
172. ress Message Message Line Connected is 377 Illegal u Transmitting ATS ES SEE Receiving RCVG m ON ON OFF Program Status PROG Both Flashing Processor Status PROC C7 I Alternately ON ON ON or OFF ON ON r Both Flashing Momentary Continuous ON Alternately Communication Program Fault in Processor Fault in Module Zone of Program Communication Communica Memory Circuitry Being Checked Zone tion Detected at Fault Power Up 11838 The following paragraphs describe each indicator and its significance to the troubleshooter XMTG Transmitting This green indicator is ON when the module is transmitting command or reply messages However it is not ON when response codes are transmitted RCVG Receiving This green indicator is ON when the module is receiving command or reply messages ACTV Active This green indicator is ON when a cable is connected from an RS 232 C compatible device to the receiving pins of the RS 232 C PORT connector and power is ON at both ends PROG Program Status This red indicator goes on during a series of communication zone rung checks in the user s program If the module detects an error it will remain ON until the PC processor enters program mode or is downloaded The program status indicator is normally OFF 7 2 Chapter 7 Start Up and Troubleshooting The module checks the communication zone rungs of a program at power up in run or test and whe
173. rite commands With a programmed EPROM installed in a Mini PLC 2 15 processor the module rejects any write command addressing words above 177g regardless of this switch setting Also with the memory write protect jumper removed from a PLC 2 30 processor the module rejects any write command addressing words above 377g regardless of this switch setting Protocol The protocol switch selections are ON The module communicates as a slave in a master slave relationship through a half duplex polled protocol OFF The module communicates in a peer to peer relationship through a full duplex unpolled protocol If you use the module in an RS 232 C link to another Allen Bradley communication module set the switch to OFF for the full duplex unpolled protocol Series B Module Options On the Series B 1771 KG module Switches 3 and 4 of switch assembly SW 2 each provide an option selection the other three switches provide eight combinations of selections for four other options Figure 4 3 B Chapter 4 Installation Figure 4 3 Option Switch Settings SW 2 O1 2 3 5 N E A SERIES A MODULE F A A A Protocol ON Half Duplex Slave OFF Full Duplex Peer to Peer Accept Physical Writes ON Enabled OFF Disabled Accept Unprotected Writes ON Enabled
174. rk since it could be that the only way to free up space is for the slave to send a message to the master This situation is illustrated in Figure 6 24 Figure 6 24 Message Sink Full Case 2 SOURCE SOURCE SINK MASTER LINK SLAVE SINK XXXX gt DLE SOH STN DLE STXxxx DLE ETXBCC gt Full Timeout Not Full DLE ENQ SIN BCC XXXX DLE STXxxxx DLE ETX BCC lt _ Xxxx DLE ACK gt DLE SOH STN DLE STXxxxx DLE ETXBCC gt Not Full XXXX gt lt OK 11575 Network Layer Chapter 6 Communication Protocol Line Monitoring When monitoring half duplex protocol on a two wire link you need to monitor only one line The example below shows a message sent by the master and a reply sent by the slave in answer to a poll Slave responses are in bold Message from Master to Slave DLE SOH STN DLE STX xxxx DLE ETX BCC DLE ACK Message Sent from Slave to Master in Answer to Poll DLE ENQ STN BCC DLE STX xxxx DLE ETX BCC DLE ACK Poll with a DLE EOT Answer DLE ENQ STN BCC DLE EOT The network protocol defines a network packet format for interaction between application programs Regardless of which link protocol is used the link protocol merely serves to carry data blocks between two applications The application programs may be located at opposite en
175. rmat 00 00 Reply Format DST SRC CMD STS TNS 40 Set Data Table Size This command sets the data table size in bytes The data table size is also the physical address of the start program Select a proper data table size as specified in the programming manual for the PLC 2 family processor You must only use this command together with other commands in download procedure see Upload Download Procedures Series B Modules This command is available on the Series B module only Command Format DST SRC CMD STS TNS FNC DATA 06 00 08 Reply Format 46 Chapter 6 Communication Protocol SET ENQS This command sets the maximum number of ENQs that the module issues per message transmission The default setting is three Command Format DST SRC CMD STS TNS FNC DATA 06 00 06 1 Byte Reply Format DST SRC CMD STS TNS 46 SET NAKS This command sets the maximum number of NAKs that the module accepts per message transmission The default setting is three Command Format DST SRC CMD STS TNS FNC DATA 06 00 05 1 Byte Reply Format 46 6 59 Chapter 6 Communication Protocol 6 60 Set Timeout This command sets the maximum amount of time that the module waits for an acknowledgment to its message transmission The setting is expressed as the number of cycles of an internal clock where 38 cycles equals 1 second The default setting is 38 cycles or 1 second Command Format
176. rmat DST SRC CMD STS TNS FNC 06 00 07 Reply Format 46 Diagnostic Loop This command checks the integrity of transmissions over the communication link It transmits up to 243 bytes of data to a 1771 KG module The receiving module should reply to this command by transmitting the same data back to the originating station Command Format DST SRC CMD STS TNS FNC DATA Max of 243 Bytes 06 00 00 Reply Format 46 6 51 Chapter 6 Communication Protocol Diagnostic Read This command reads up to 244 bytes of data from the internal ROM and RAM areas of the 1771 KG module It can be used to read the module s diagnostic timers and counters refer to Appendix B Command Format DST SRC CMD STS TNS FNC ADDR SIZE 06 00 01 Reply Format 46 Diagnostic Status This command reads a block of status information from the 1771 KG module Command Format DST SRC CMD STS TNS FNC 06 00 03 Reply Format 46 The information is as follows Operating status of PC processor as shown in Table 6 D Type of station interface module as shown in Table 6 E Octal word address of the start of PC program Always zero Starting address of diagnostic counters and timers Revision level of the module as shown in Table 6 F Settings of communication rate and option switches on the module as shown in Table 6 G Chapter 6 Communication Protocol Table 6 D Status Byte 1 Bit Values 0
177. rom a receiver to a transmitter with message codes sent from a transmitter to a receiver unless the embedded response switch is OFF Figure 6 3 shows this implementation Figure 6 3 Software Implementation of Data Paths Transmitter Receiver A B I I Path 2 Path 1 Path 2 Path 1 re Physical Circuit AB Physical Circuit BA S md M Path 3 Path 4 Path 3 Path 4 Y Y Receiver Transmitter A B M Software Multiplexer S Software Separator 11557 Chapter 6 Communication Protocol Figure 6 4 shows Path 1 with unrelated parts of Figure 6 3 removed We could show Paths 2 3 and 4 in a similar way Figure 6 4 Data Path 1 Transmitter Receiver A B Path 1 Path 1 11558 The full duplex protocol is symmetrical that is anything that we can say about Transmitter A Receiver B and Paths 1 and 2 applies equally to Transmitter B Receiver A and Paths 3 and 4 There are actually two independent instances of the protocol operating simultaneously For simplicity we define the link protocol on the subsystem that carries messages from A to B with reference to Figure 6 5 Figure 6 5 Message Transmission from A to B Transmitter A Path 2 Receiver B Path 1 Path 2 Path 1 Path 1 Path 2 S M 11559 Chapter 6 C
178. rotocol that uses the following ASCII control characters extended to eight bits by adding a zero for Bit 7 See ANSI X3 4 CCITT V 3 or ISO 646 for the standard definition of these characters Control Character Hexadecimal Code SOH Start of Header STX Start of Text ETX End of Text EOT End of Transmission ENQ Enquiry ACK Acknowledge DLE Data Link Escape NAK Negative Acknowledge Additionally a block check character BCC or two byte cyclic redundancy check CRC field is used at the end of each transmission packet for error checking These bytes can be any value from 00 to FF hex The term code means in the following paragraphs an indivisible sequence of one or more bytes having a specific meaning to the protocol Indivisible means that the component bytes of a code must be sent one after another with no other bytes inserted between them It does not refer Chapter 6 Communication Protocol to the timing of the bytes This definition has less significance than for full duplex protocol since there is no multiplexing of transmission codes in half duplex protocol Half duplex protocol uses the following codes Control Codes DLE SOH DLE STX DLE ETX BCC CRC DLE ACK DLE NAK DLE ENQ DLE EOT Link Layer Data Codes Data single bytes having values 00 0F and 11 FF hex DLE DLE to represent the value 10 hex Link Layer Address Code STN slave station number We can group these codes in
179. rried out automatically by the communication modules However an understanding of station interaction is useful both to computer programmers and PC programmers 3 5 Chapter 3 Communication Concepts 3 6 Error Checking When a command cannot be carried out due to a user programming error or a discrepancy in data handled by the module an error code may be written into a PC data table memory word The error code storage word is selected by the PC programmer and listed in the header rung of the communication zone of the PC program This word stores the most recent error code written by the communication module Error codes can be generated at two places the remote station and the local station interface modules For codes that are returned from a local station module two types of conditions can exist Application programs use the wrong message format or issue illegal commands The local station cannot complete a transaction due to network problems A remote station can return only the codes associated with an application problem at the remote station Typically these involve either the processor being off line in program mode for example or the command trying to access memory areas blocked by either the communication module or the communication zone of the PC program On the network layer protocol command message status is returned in a status byte A value of zero in the status byte indicates successful transmissio
180. s Communication Concepts The 1771 KG module can be applied to Data Highway networks which can include a Data Highway link or a stand alone RS 232 C link This chapter presents concepts of these communication applications Message structures error checking and data security are discussed Data Highway link protocol is discussed in general to help you understand the choices you must make before installing and operating your network RS 232 C link protocol is described in detail in Chapter 6 A Data Highway link has a communication rate of 57 6k bits s It provides peer to peer communication between stations through a half duplex polled protocol A 1771 KG module provides an interface to an RS 232 C link It has a selectable communication rate of 19 2K bits s maximum The RS 232 C link can be within a Data Highway network as an auxiliary link to the Data Highway link The RS 232 C link can also be a stand alone link For an auxiliary link or a stand alone link to another Allen Bradley communication module it provides peer to peer communication through a full duplex unpolled protocol For a stand alone link to a computer you can select it to provide either Peer to peer communication through a full duplex unpolled protocol Master slave communication through a half duplex polled protocol All messages on a Data Highway network have the same fundamental structure regardless of their function or destination If you could freeze
181. s High Priority Normal Priority Priority levels determine the order in which messages are transmitted through a Data Highway link High priority messages are transmitted and executed before normal priority messages The programmer designates a priority level for each command message The command code an element in each command rung specifies the priority level of the command message The station which receives a command message automatically establishes the same priority level for its corresponding reply message The command code is described this chapter under Command Code NOTE High priority commands are executed ahead of normal commands throughout the command reply message cycle For this reason give a command a high priority designation only when special handling of specific data is required Using an excessive number of high priority commands defeats the purpose of this feature and could delay or inhibit the transmission of normal priority messages General Definition of Link and Protocol Communication Protocol This chapter describes the communication protocol used on an RS 232 C link to the 1771 KG module It explains the programming you need to do at both the data link level and the network management level to enable communication over the RS 232 C physical link Specifically this chapter outlines the logic for input output drivers transmitters and receivers used on the RS 232 C link Also described are the
182. se you could add a special set of test rungs at the end of the user program Using these rungs you can control command initiation directly from the programming terminal CAUTION Do not alter the application program for troubleshooting purposes This can cause undesired machine operation since the program may no longer operate as had been intended Chapter 7 Start Up and Troubleshooting Optional test rungs described here are recommended with this caution in mind The specific format of these rungs allows control of commands without altering the main body of the application program Because these tests rungs are within a ZCL zone the output instructions of these rungs are executed only under strict programmer controlled conditions and only when the programming terminal is connected Except where intentionally activated by the proper key sequence these rungs are ignored by program logic in normal operation The optional test rungs are shown in Figure 7 4 Within this ZCL zone the start bit is unconditionally latched on Rung 2 and unlatched when the done bit is on Rung 3 In Rung 1 a single input image table bit is the condition for this ZCL zone Figure 7 4 Optional Test Rungs Input address for Force ON manipulation Input address which is always turned OFF Rung by I O scan l 1 zek 00 Start Bit d Rungs may a Lo be left in 10 program for Done Bit Start Bit subsequent 032 032 trouble
183. sed as if they are transmitted to a PLC 2 family processor at a remote station If another type of PC processor is at the remote station refer to the manual for the communication module of that processor for information on how to address that processor s data table For a computer and some processors at a remote station to accept commands from this local station you must provide a file at that remote station to simulate a PLC 2 family data table Before any communication can occur between a remote station and your local station PC through the 1771 KG module you must provide a communication zone in your ladder diagram program Figure 5 1 The overall format for the communication zone rungs of the program is shown in Figure 5 1 This figure shows each type of rung which can be entered in this zone Actual communication zone rungs for any station processor may vary The length of this zone is a function of the number of remote stations with which the local station processor communicates and the number of types of commands to be sent to these remote stations 5 1 Chapter 5 PC Programming Figure 5 1 Communication Zone Format START Header 011 077 015 027 Rung El GG G L 07 020 070 076 017 022 022 027 Memory f Memor aeaaeae C Rung 017 063 065 010 060 062 G 161 4168 186 316 18 Block 032 020 016 022 024 027 Read Write F eea 10 00 07 mw 032 017 120 120 120
184. sed to control the following Any bit whose status is controlled by a programmed output instruction In any PLC 2 Family Processor Any bit in a byte which also contains program controlled bits Chapter 5 PC Programming The first restriction simply states that you should not attempt to directly control a bit by both an output instruction at its local station processor and a bit write command from some remote station processor This rule applies to all processors Bit write commands are generally used to set storage bits in a remote station processor data table These storage bits may then be examined in the user program as conditions to energize an output bit This indirect programming technique allows control using bit write commands but helps to prevent the confusion that can result if you attempt to control a bit directly from both an output energize instruction and a bit write command Figure 5 22 gives an example of an indirect programming technique used to control Bit 01001 Here Storage Bit 12104 is controlled by the bit write command This bit is then examined by the program to control the status of Bit 01001 Note that Output Bit 01001 cannot be directly addressed by the bit write command However by controlling the storage bit and examining that storage bit in the program the desired effect is achieved Figure 5 22 Bit Control Use Example A Original Rung Control of this output desired However bit already a
185. sending of tested command message Start Bit 032 057 T3 i Insert between Optional Test PR 999 Rungs No 3 and 4 if needed AC 000 Note that the counter value shown on the programming terminal may not display the actual number of times a command has been sent due to CRT delay time However the purpose of the counter is to provide an indication to the troubleshooter that the command is being continuously executed rather than to give an actual count of the number of times it is executed Again the use of these test rungs is optional subject to the discretion of the programmer An advantage of these rungs is that they may be kept at Chapter 7 Start Up and Troubleshooting the end of the user program after start up is completed This enables the use of these rungs in troubleshooting or later testing as when a command rung is subsequently added to the communication zone of program Of course these rungs can be removed after start up is completed at the programmer s option Necessary Documentation For testing and troubleshooting command execution the following documentation should be available at each station Copy of the ladder diagram program in the station processor Completed forms giving the following information Communication module switch settings Figure 7 6 Listing of commands sent by the station Listing of commands received by the station A ladder diagram printout can be ge
186. ses that the Start Bit has been set OFF 11319 Controlling the Start Bit Your program controls the start bit setting it ON to initiate command execution turning it OFF after command completion or after a fault is detected In several examples that follow start bits are turned ON with latch instructions and OFF with unlatch instructions This is done for ease of explanation but is not necessarily the best technique for your application To turn ON 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 ON or OFF Status of a Bit Transition of a Bit Timed Condition 5 21 Chapter 5 PC Programming 5 22 To turn OFF the start bit the program examines the response from the 1771 KG module This response may be one of the following Done Bit Remote Fault Bit Local Fault Bit The next three sections describe 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 turn OFF the start bit An important assumption underlies the examples outlined in the next three sections and shown in Figures 5 14 through 5 16 The assumption is that the program should automatically retry transmission of
187. sfully receive the last message sent Link Layer Message Packets A link layer message packet starts with a DLE STX ends with a DLE ETX BCC CRC and includes all link layer data codes in between Data codes can occur only inside a message packet Response codes can also occur between a DLE STX and a DLE ETX BCC CRC but these response codes are not part of the message packet they are referred to as embedded responses Figure 6 1 shows the format of a link layer message packet for full duplex protocol and the layer at which each portion should be implemented At the end of each message packet is either the one byte BCC or two byte CRC field With the Series A module you must use BCC With the Series B module you can select either BCC or CRC through switch settings Chapter 4 Chapter 6 Communication Protocol Figure 6 1 Link Packet Format for Full Duplex Protocol From CMD STS FNC ADDR DATA Application Layer N N N N N Data From DST SRC CMD STS b From Application Layer pon d Pd Pd N wer N S ae N p d P DLE STX Data DLE ETX BCC From Network Layer CRC 11321 Block Check The block check character BCC is a means of checking the accuracy of each message packet transmission It is the 2 s complement of the eight bit sum modulo 256 arithmetic sum of all data bytes between the DLE STX and the DLE ETX BC
188. sical address will also be a byte address To send a physical read or write command to a PLC 2 station put the PLC 2 physical address in the ADDR field of the command message format Be sure to encode the low byte of the physical address as the first byte in the ADDR field Figure C 7 Converting PLC 2 Logical to Physical Address PLC 2 Word Address 121 Octal Logical Byte Address 242 Octal Physical Byte Address 0046 Hex High Byte Low Byte 17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00 Bit Number Logical Octal Byte Address 210 0 o ojojojo tjo 1 ojo o 1 oj Octa 17 16 15 14 13 12 11 10 07 06 05 04 08 02 01 00 Physical ByieAddress 0101010 0j0 0 0 0 1 0 0 0 1 1 O us General Appendix Detailed Flowcharts In Chapter 6 are flowcharts which give a simplified view of an example of software logic for implementing full duplex protocol In this appendix we present flowcharts which give a detailed view of an example of software logic for implementing full duplex protocol The flowcharts in this appendix are based on the use of CRC rather than BCC for error checking Figure D 1 shows a data flow diagram Figure D 2 shows a logic flowchart of a transmitter routine Figure D 3 shows a logic flowchart of a receiver routine Each subroutine appears in a subsequent figure D 1 App endix D Detailed
189. ssage to the remote station and receive an acknowledgment Your network layer then turns the command around stuffs the low nibble of the STS byte with the appropriate error code and returns it to your application level All error codes are listed in Appendix A Only the last 11 apply to PC to computer communication When you receive a reply message from a PC station check the STS byte at the application layer If the STS byte is non zero refer to Appendix A for the type or error that has occurred When your application layer detects an error while attempting to execute a received command message it should format a reply message with a remote error code in the high nibble of the STS byte for the remote station to interpret ADDR The ADDR field is a two byte field sent low byte first In PC programming logical octal byte addressing is used A protected unprotected logical read write command operates on the ADDR field based on the same octal addressing format as shown in Figure 6 28 A A physical read write command operates on the ADDR field based on the physical addressing format shown in Figure 6 28 B If you access a word through a logical read write command with a logical address and then attempt to access the same word through a physical read write command with the same logical address you would actually address a different word because a physical address is assumed If you always read and write into the data table with commands th
190. ssor Should this indicator go ON connect and initialize a programming terminal and follow these procedures to isolate the source of the fault condition The steps of this procedure are outlined in Figure 7 7 1 Using the search functions display the rung of program which controls the external fault indicator device Determine whether a status bit indicates that either a remote or local fault bit is set ON 2 Using the search functions display the rung of program which examines either the remote or the local fault bits and controls a status bit or bits based on fault bit states 3 Examine each element of the rung which may have been set ON causing the fault indicator to be ON When you use the rungs recommended in Figure 5 18 EXAMINE OFF instructions address each fault bit When these instructions are displayed on the program panel or industrial terminal check the status indicators of the terminal carefully Due to CRT delay time the intensity of an EXAMINE OFF instruction may not change as rapidly as the actual ON OFF status of the fault bit changes Recall that programmed retries continuously turn the fault bit ON and OFF Thus it may take a few seconds for the programming terminal to show a change in fault bit status Should you have difficulty detecting the changing ON OFF bit status for an individual fault bit use the contact histogram feature to display changes in status 4 From the results of Step 3 determine the star
191. st use a master slave communication protocol because the link can support only one channel A computer can send or receive messages through a stand alone link in the same way as through a Data Highway link network Program the computer to follow the communication protocol described in Chapter 6 2 6 Chapter 2 Application Considerations Figure 2 4 Stand Alone Multi Drop Link to a Computer Computer MODEM MODEM MODEM MODEM 1771 KG 1775 KA 1771 KG Module Module Module PLC 2 15 PLC 3 PLC 2 30 Processor Processor Processor 11302 Configuration Selection Figures 2 1 through 2 4 illustrate several configurations in which a PLC 2 family processor can communicate with computers and or other PC processors through RS 232 C ports provided by 1771 KG modules Each is useful depending on your application If you want to provide peer to peer communication between a PLC 2 family processor and two or more other stations use a Data Highway network as shown in Figure 2 1 If the PLC 2 family processor is close enough to the other stations 10 000 cable feet you can use a 1771 K A module to interface directly with the Data Highway link If the distance is too far you can use a 1771 KG module to interface with a longline 2 7 Chapter 2 Application Considerations A Second Link 2 8 RS 232 C link or MODEM l
192. t and independent software routines Figure 6 2 shows these software routines as Transmitters XMTR A and B and Receivers RCVR A and B Figure 6 2 Data Paths for Two Way Simultaneous Operation Path 1 Transmitter g Receiver A a B Path 2 Path 3 Receiver Transmitter A B Path 4 11556 Transmitter A and Receiver B manage the transfer of messages from Station A to Station B by sending message packets from A to B and returning response codes from B to A At the same time Transmitter B and Receiver A carry out the transfer of messages from Station B to Chapter 6 Communication Protocol Station A by sending message packets from B to A and returning response codes from A to B There are also four independent data paths involved Path 1 carries message codes from A to B Path 2 carries response codes from B to A Path 3 carries message codes from B to A and Path 4 carries response codes from A to B To implement all these data paths with only two physical circuits you need a software multiplexer that combines the message codes with the response codes going in the same direction At the other end of the link you need a software separator that separates the message codes from the response codes again Internal software should direct the message codes to the receiver and the response codes to the transmitter On each physical circuit you can intermingle response codes f
193. t bit address for the corresponding command The start bit has a strictly defined correspondence to a remote or local fault bit Figure 5 9 7 20 Chapter 7 Start Up and Troubleshooting Figure 7 7 REMOTE LOCAL FAULT Troubleshooting Example Step 1 Search Output Address Key Sequence SEARCH L 0 1 0 0 0 Display Local Fault Output Status Indicator 055 010 It L 00 TER 00 Remote Fault Status 055 Instruction intensified Thus Local T Fault Status Bit 05500 is OFF ifl 01 Step 2 Search Local Fault Bit Monitoring Rung Key Sequence SEARCH 0 5 5 0 0 Display Instruction normal intensity Thus this bit is ON Local Fault Status 032 032 032 032 032 032 032 032 055 Lh a Eu a E 00 01 02 03 04 05 06 07 00 If bit monitoring is available display Remote Local Fault Status Word to examine Fault Bit status Step 3 Locate any Fault On in this rung Here Bit 03202 is ON Step 4 Identify Start Bit for this Fault Bit For Local Fault Bit 03202 the Start Bit is Bit 03112 Step 5 Search the Start Bit Examine instruction Key Sequence SEARCH 0 3 1 1 2 Display Start Command Bit Code 031 023 052 020 022 027 Haea 12 00 000 000 000 07 Step 6 Determine Area of Hardware Related Problem Here the Command Code identifies Station No 023 Conclusion Local Fault between Local Station and Remote Station with Stati
194. t monitoring a user programmed timeout is useful as a backup to the other monitoring functions of the 1771 KG module Remote and local fault bits at other stations indicate the same types of faults that can be detected using a user programmed timeout A programmed timeout would not be necessary for each command from a station Instead you can monitor a single command at each station in this manner Select a command that is sent regularly for this type of monitoring There may be other instances where program monitoring of commands is useful In some cases you might program a timeout to monitor the execution time of critical commands An application may require that a critical message such as a priority command be sent within a certain limited amount of time You can program a TON instruction for this purpose here however its preset interval will generally be shorter than the interval entered as the timeout preset for the module 5 35 Chapter 5 PC Programming Memory Access Limitations 5 36 Before transmitting write commands to a remote station you should become aware of what areas of that station s data table is accessible to you This information is available either in the programming manual for that processor or the manual for its communication module Further general memory access limitations are discussed in the following sections Protected Unprotected The memory access of protected commands is controlled by the re
195. the RS 232 C PORT connector and power is on at both ends PROG Program Status This red indicator should go ON momentarily at power up and when the PC processor is switched into a test or run mode This indicator will stay ON if the module detects a format error in the communication zone of the ladder diagram program PROC Processor Status This red indicator will go ON when the module is not connected to the PC processor Chapter 1 Introduction Figure 1 2 Communication Connections PC COMM INTERFACE XMTG RCVG ACTV PROG PROC Q Intelligent RS 232 C Compatible Device PROGRAM INTERFACE Processor N v PROCESSOR z Industrial Terminal 11298 Series B Enhancements Specifications Chapter 1 Introduction This manual describes both the Series A and Series B versions of the 1771 KG module Table 1 A lists the Series B enhancements to the module These features were not available on the Series A version of the module Where we describe these features later in the manual we note that they are only available on the Series B version of the module You can see the catalog number and the series level of the module on the nameplate on the side of the module Table 1 A Series B Enhancements Set Data Table Size This command provides your computer with the capability to Command change t
196. the circuitry on the module RTS is a request from the module to the MODEM to prepare to transmit It typically turns the data carrier ON In full duplex mode RTS is always asserted In half duplex mode it is turned ON when the module has permission to transmit otherwise it is OFF Answering Chapter 4 Installation CTS is a signal from the MODEM to the module that the carrier is stable and the MODEM is ready to transmit The module will not transmit until CTS is ON If CTS is turned OFF during transmission the module will stop transmitting until CTS is restored DTR is a signal from the module to the MODEM to connect to the phone line i e pick up the phone The module will assert DTR except during the phone hang up sequence MODEMS built to American standards will not respond to DTR until the phone rings Some European MODEMS will always connect the phone line whether the phone is ringing or not The module will not work with these types of European MODEMS DSR is a signal from the MODEM to the module that the phone is off hook Itis the MODEM S answer to DTR The module will not transmit or receive unless DSR is ON If the MODEM does not properly control DSR or if no MODEM is used DSR must be jumpered to high signal at the connector You can jumper it to DTR DCD is a signal from the MODEM to the module that the carrier from another MODEM is being sensed on the phone line It will not be asserted unless
197. the low byte first 6 49 Chapter 6 Communication Protocol 6 50 Application Message Formats PLC 2 family processors use the message formats described in this section You must follow these message formats when generating a command or reply message from your computer application program The format for each command and its corresponding reply is listed below in the following order Diagnostic Counters Reset Diagnostic Loop Diagnostic Read Diagnostic Status Enter Download Mode Enter Upload Mode Exit Download Upload Mode Physical Read Physical Write Protected Bit Write Protected Block Write Set Date Table Size Set ENQs Set NAKs Set Timeout Set Variables Unprotected Bit Write Unprotected Block Read Unprotected Block Write In each of these formats the hexadecimal value is given for the CMD and FNC bytes In each of these formats the fields provided by the network layer are also shown to indicate where the application layer fields fit in the network packet However the fields provided by the network layer are shown shaded to indicate that they are not provided by the application layer Chapter 6 Communication Protocol Diagnostic Counters Reset This command reset to zero all the diagnostic timers and counters used by the 1771 KG module The diagnostic status command gives the starting address for this block of counters and timers Command Fo
198. the phone is off hook Data will not be received at the module unless DCD is ON In full duplex mode the module will not transmit unless DCD is true If the MODEM does not properly control DCD or if a MODEM is not being used you must jumper DCD to DTR at the module TXDRET is the return signal for TXD It is connected to module logic ground through a resistor It does not conform to RS 232 C specifications RXDRET is the return signal for RXD It is connected to the isolated receiver and is isolated from all other circuitry on the module It does not conform to RS 232 C specifications The module continually asserts DTR when it is waiting for a call Under this condition the MODEM will answer a call and assert DSR as soon as it detects ringing The module does not monitor the RING indicator signal Once it detects DSR the module starts a timer approximately 10 seconds and waits for the DCD signal When it detects DCD communication can start If 1t does not detect DCD within the timeout the module turns DTR OFF This causes the MODEM to hang up and break the connection When the hang up is complete the MODEM turns OFF DSR This causes the module to reassert the DTR line and wait for another call This feature protects access to the phone if someone calling a wrong number reaches this station 4 21 Chapter 4 Installation 4 22 Once DCD is detected the module continues to monitor the DCD line If DCD goes OFF the module
199. through 15 respectively Each group of four data bits represents one hexadecimal digit between 0 and F In this way each 16 bit data word can have a hexadecimal value between 0 and FFFF Each digit of a hexadecimal number has a place value that is a multiple of 16 To convert a hexadecimal number to its decimal equivalent multiply each hexadecimal digit by its corresponding place value and add the results of the multiplications Figure C 4 shows the hexadecimal representation of the decimal number 423 Appendix C Data Manipulation Figure C 4 Hexadecimal Numbers 0x2320 0x22 0 016 0x2 0 0x29 0 0x23 0 0x22 0 116 0x2 20 1x2021 1x2328 0x22 0 A16 1x21 2 0x20 0 0x2320 1x22 4 74 1x21 2 1x 20 1 0 0 0 0 0 0 1 1 0 1 0 0 4 1 1 1 0x 168 0 1 x 162 256 10 x 16 160 7x16027 01A716 42316 11335 Octal The octal number system is also a relatively easy way to represent binary data This system uses the eight digits O through 7 Each group of three data bits represents one octal digit between 0 and 7 This presents a slight conversion problem because bytes and words usually contain an even number of bits Thus an eight bit byte can have an octal value between 0 and 377 while a 16 bit word can have an octal value between 0 and 177777 C 5 Appendix C Data Manipulation C 6 Each digit of an
200. tion disables communication on the Data Highway link as long as other stations continue to operate This means that even with disconnection or faulted operation of a communication module or a processor communication between other operating stations continues This minimizes the need for redundancy in some applications When a station gains control of the Data Highway to transmit messages it has become a master station All other station interface modules assume a slave mode This enables these stations to receive and acknowledge messages sent to them Basically a station has three states Transmitting Message Packets Polling to Determine which Station Gets Mastership Next Receiving and Responding to Message and Polling Packets Thus each Data Highway station can transmit and receive both message and polling packets Figure 3 1 shows the change of states at a station Chapter 3 Communication Concepts Figure 3 1 State Transitions at Master Station Contention E Sending i State Have All Sent or Max of 16 or sspe A All High Priority Messages Stations Have Sent and Response to High Been Polled Priority Global Poll at Least Once Y Received Polling Mastership State Relinquished Mastership Received gt State 11536 Message Transmission A station must possess mastership of the Data Highway before it can transmit any message or polling packets As part
201. tions for them The following Allen Bradley modules provide general communication functions for PC processors PLC Computer Interface Module Cat No 1774 CI2 PLC Communication Adapter Module Cat No 1774 KA PLC 2 Family Communication Adapter Module Cat No 1771 KA KA2 PLC 3 Communication Adapter Module Cat No 1775 K A PLC 4 Communication Interface Module Cat No 1773 K A PLC 2 Family RS 232 C Interface Module Cat No 1771 KG Communication Control Module Cat No 1771 KC KD KE KF PC Processor Data Highway Interface The following modules provide an interface function between a PC processor and a Data Highway communication link PLC Communication Adapter Module Cat No 1774 KA PLC 2 Family Communication Adapter Module Cat No 1771 K A PLC 3 Communication Adapter Module Cat No 1775 K A PLC 4 Communication Interface Module Cat No 1773 K A PC Processor RS 232 C Interface The following modules provide an interface function between a PC processor and an RS 232 C communication link PLC 3 Communication Adapter Module Cat No 1775 K A PLC 4 Communication Interface Module Cat No 1773 K A PLC 2 Family RS 232 C Interface Module Cat No 1771 KG 2 1 Chapter 2 Application Considerations Data Highway Network 2 2 RS 232 C Data Highway Interface The following modules provide an interface function between an RS 232 C communication link and a D
202. to two classes according to their use codes issued from a station transmitting a message or poll and response codes issued from a station receiving a message or poll Codes from Station Transmitting a Message or Poll DLE SOH Indicates the start of a message packet STN Station number of a slave station DLE STX Separates the data link protocol information from the network packet Link Layer Data 00 0F and 11 FF hex Encodes the bytes of the network packet DLE DLE Encodes the value 10 hex in the network packet This is necessary to distinguish a text code of 10 hex from a DLE control code of 10 hex DLE ETX BCC CRC Terminates a message or polling packet DLE ENQ Indicates the start of a polling packet 6 25 Chapter 6 Communication Protocol Response Codes from Station Receiving a Message or Poll DLE ACK Signals that the receiver has successfully received the last message sent DLE NAK Serves as a global link reset command It causes all slaves to cancel all messages they have ready to transmit to the master The 1771 KG module will respond to this by writing Error Code 84 into its error word in the PC data table DLE EOT Is the response that a slave sends to a poll from the master when the slave has no messages to send Link Layer Packets Half duplex protocol uses three types of transmissions Polling Packet Master Message Packet Slave Message Pac
203. uction incorrectly entered in memory access rung Third GET instruction incorrectly entered in memory access rung Starting address for memory access boundary is greater than ending address Branch end missing in memory access rung Output instruction missing at end of memory access rung Invalid first element in a communication zone rung Invalid address for start bit Start bits must be in the upper byte Bits 10 17 of a word Invalid second element in a command rung Invalid command code Invalid station number in command rung Invalid element in bit write command rung First GET instruction incorrectly entered in word read or write command rung Second GET instruction incorrectly entered in word read or write command rung Third GET instruction incorrectly entered in word read or write command rung Output instruction missing at end of command rung Invalid beginning of command rung or memory access rung follows com mand rung Local remote fault word is outside the data table start done word incorrectly chosen Transmission of unprotected commands is disabled by switch settings A 3 Appendix A Error Reporting Low Byte of Error STS Byte of Reply Fault Bits Word in Hex Message in Hex Local Remote Meaning of Error Code Too many command rungs 255 is maximum 27 28 29 31 36 37 38 50 51 52 53 55 56 57 81 83 84 85 86 30 40 50 60 ON ON ON
204. ule must prevent other PC s from accessing what may be a partial data table The module must also prevent an industrial terminal from accessing the program during a download The module will block other access to the PC memory during download if the general procedure for downloading follows this order Enter Download Mode Set Data Table Size if required Physical Write Physical Write Physical Read verification Exit Download Upload Mode If you download a program that requires a change in the data table size send a set data table size command before sending physical write command containing the new program The set data table size command is only available on the Series B 1771 KG module If you have a Series A 1771 KG module the only way you can change the data table size is through an industrial terminal If you send a set data table size command that increases the size of the data table send a physical write command to clear out that part of the data table that had previously been in the program area When downloading a program always write zeros into the unused portion of the memory following the program After you write the new program into the PC memory verify the new program through physical read commands before exiting the download mode However you will be unable to verify the first word in the program until after exiting the download mode The 1771 KG module does not write that word into memory until exiting the download
205. value of 10 hex as two consecutive indivisible bytes each of value 10 hex This is necessary to distinguish the text value of 10 hex from the DLE control code of 10 hex This technique is known as DLE stuffing The receiver must be able to reverse this process and extract the original text value of 10 hex Figure 6 7 is a flowchart which gives a simplified view of an example of software logic for implementing the transmitter Table 6 A gives a detailed description of an example of software logic for implementing the transmitter in structured English procedures In Appendix D are flowcharts which give a detailed view of an example of software logic for implementing the transmitter Chapter 6 Communication Protocol Figure 6 7 Transmitter for Full Duplex Protocol Retransmit Same Message Message Packet DLE STX Data DLE ETX BCC Timeout Loop Received Received No DLE ACK DLE NAK 3 3 NAKs Yes Yes Timeouts Received for this Py for this Message Message Legend No D Recovery Procedure me DLE ENQ Cr Ready to Transmit Next Message Default Values Used by the Module tH__ 11322 6 13 Chapter 6 Communication Protocol Table 6 A Transmitter for Full Duplex Protocol TRANSMITTER is defined as loop Message GET MESSAGE TO SEND Status TRANSFER Message SIGNAL RESULTS Status end TRANSFER Message is defi
206. vious Response Code at RESP SEND Transmit CRC High Byte TXFREE Deallocate UART RETURN 11663 D 12 Appendix D Detailed Flowcharts Figure D 14 SENDDATA Subroutine SENDDATA Input e Link Data Byte TXALLOC Allocate UART or Wait SEND Transmit Link Data Byte SEND Is Data Yes Byte DLE Transmit a 2 Second DLE TXFREE De allocate UART RETURN 11666 D 13 Appendix D Detailed Flowcharts Figure D 15 TXALLOC Subroutine TXALLOC SLEEP Yes Wait at TXALWT Until UART Is Free No Set IN USE Flag Indivisible Zone Common v e N USE Flag RETURN e TXALWT A Sleep Variable 11667 Figure D 16 TXFREE Subroutine TXFREE Common Reset IN USE e IN USE Flag d e TXALWT A Sleep Variable WAKEUP Continue Any Process at XALWT RETURN 11668 D 14 Appendix D Detailed Flowcharts Figure D 17 SEND Subroutine SEND Input e Link Data Byte Common e TXWAIT A Sleep Variable i ree Disable Processor ee LLL Ln E Interrupts E Enable UART Transmit Interrupt SLEEP UART No Transmitter Suspend at Empty TXWAIT Disable UART Transmit Interrupt Output Byte to UART Indivisible Zone L Enable Processor
207. wed how the fault bits can be programmed to unlatch the start bit in a fault situation and thus provide automatic retries through the program When used in this manner however a fault bit will be rapidly cycled ON and OFF if a fault is detected Because the fault bit can be constantly changing state at a rapid rate the program must use some method of detecting this transient state of any fault bit and controlling the output device based on this state Figure 5 18 shows a simple method for the control of a fault indicator Here either the remote or local fault bit can turn ON the output indicator The indicator remains ON until the done bit is energized This then unlatches the output indicator in the second rung This example allows for the transience of the fault bits since the first rung need only be true once for the output indicator to be latched The method of Figure 5 18 can be extended to monitor multiple commands from a station controlling multiple output indicators as necessary However where more than one command is sent from a station the use of multiple output indicators may not be practical In this instance a single output indicator can be used to signal all remote or local fault conditions for commands from that station Figure 5 19 shows a method for fault indicator control assuming multiple commands Chapter 5 PC Programming Figure 5 18 FAULT Bit Diagnostic Rungs Sin
208. with other commands in an upload procedure see Upload Download Procedures Series B Modules This command is available on the Series B module only Command Format DST SRC CMD STS TNS FNC 07 00 06 Reply Format 47 6 55 Chapter 6 Communication Protocol 6 56 Exit Download Upload Mode This command exits the PC processor from either the upload mode or the download mode You must only use it together with other commands in an upload or download procedure see Upload Download Procedures Series B Modules Command Format DST SRC CMD STS TNS FNC 07 00 05 Reply Format DST SRC CMD STS TNS 47 Physical Read This command reads a block of data specified by a physical address from the PC data table or program area of memory You must only use it together with other commands in an upload procedure see Upload Download Procedures Series B Modules With a Series A module you must first put the PC processor into the program load mode before using the physical write command It requires a physical address Command Format DST SRC CMD STS TNS ADDR DATA 04 00 In the ADDR field specify an even address In the DATA byte specify an even number of bytes to read Reply Format 44 Chapter 6 Communication Protocol Physical Write This command writes a block of data specified by a physical address into the PC data table or program area of memory You must only use it together with
209. y type instruction which addresses a single bit This includes EXAMINE ON EXAMINE OFF OUTPUT ENERGIZE LATCH and UNLATCH instructions An instruction which addresses a three digit word This includes all Timer Counter GET PUT LES EQU IMMEDIATE I O and Arithmetic instructions Numeric key 7 5 Chapter 7 Start Up and Troubleshooting 7 6 Force On Function The force on function can be a useful troubleshooting tool When used in conjunction with the optional test rungs of Diagnostic Counters this function controls the initiation of each command programmed at a station This function is in effect only as long as the programming terminal is connected to the PROGRAM INTERFACE socket of the 1771 KG module When the industrial terminal 1s disconnected the force function is removed Remote Local Fault Bits The remote and local fault bits provide the chief indicator of a hardware related fault which prevents normal communication As recommended in Chapter 5 these bits may be programmed to control some output device to alert plant personnel of a fault condition When this output device signals a fault condition you can then use an industrial terminal to display the ON OFF status of any remote or local fault bit at the station processor Figure 7 2 summarizes the significance of both remote and local fault bits Error Word The error word is especially useful for station start up The codes displayed in the lower
210. yed by noise After a timeout the message is retransmitted and the DLE ACK response is detected Figure 6 19 Message Transfer with ACK Destroyed SOURCE SOURCE SINK MASTER LINK SLAVE SINK XXXX DLE SOH STN DLE STX xxxx DLE ETXBCC Not Full XXXX_ gt lt DL CK Timeout DLE SOH STN DLE STX xxxx DLE ETX BCC s DLE ACK OK 11569 Chapter 6 Communication Protocol Figure 6 20 shows a slave being polled and responding with DLE EOT because it has no messages to transfer Figure 6 20 Poll with No Message Available SOURCE SOURCE SINK MASTER LINK SLAVE SINK Not Full DLE ENQ SIN BCC No Message DLE EOT 11570 Figure 6 21 shows a slave being polled and answering with a message Because a block check error is found the master does not acknowledge instead it sends the poll to the slave again Since the slave did not receive an acknowledgment to its first message transmission it retransmits the same message in answer to the second poll The master receives the second transmission of the message with no error and responds with DLE ACK Figure 6 21 Poll with Message Returned SOURCE SOURCE SINK MASTER LINK SLAVE SINK Not Full gt DLE ENQ STN BCC X XXXX DLE STX xx xx DLE ETXBCC
Download Pdf Manuals
Related Search
Related Contents
D6540 manual - Perkins Manufacturing 血圧モニタリング・キット - アルゴンメディカルデバイスズジャパン 00798 Fuga BioParquet_(fr) Philips CSP650 Developing Applicati.. Mode d`emploi Copyright © All rights reserved.
Failed to retrieve file