m Table of Contents SIEMENS II ESD Guidelines Notes on Safety Warning Table of Contents Introduction General Function Description 1 Hardware Settings 2 Software Settings 3 Interrupt Processing 4 Commissioning the Counter Module 5 Operating Modes and Functions 6 Programming Example 7 Technical Specifications 8 SIMATIC S5 1P 281 Equipment Manual 9 Release 01 Order No: 6ES5998-0KP21 Definition of Terms Index 10 SIMATIC is a trade mark of Siemens. Subject to change without prior notice. Siemens Aktiengesellschaft Although the contents of this publication have been checked for agreement with the hardware and software described, we do not accept liability for total agreement since differences cannot be completely excluded. The information in this publication is checked at regular intervals and necessary corrections included in the next release. Your suggestions for improving this publication are welcome. I @ Copyright Siemens AG 1992 All Rights Reserved Passing on and reproduction of these documents, and utilization and disclosure of their contents is prohibited unless specifically authorized. Violations shall be cause for damage liability. All rights reserved, particularly in the event a patent is issued or a utility model patent is registered. I ESD Guidelines Guidelines for Handling Electrostatic Sensitive Devices (ESD) 1 What Does ESD Mean? Almost all SIMATIC-TELEPERM modules contain many integrated blocks or elements which use MOS technology. The technology used makes these electronic components very sensitive to overvoltages and thus to electrostatic discharge. The German abbreviation for such modules is "EGB": Elektrostatisch (2efahrdeten Elauelemente EJaugruppen Next to this abbreviation you will often find the common international abbreviation "ESD": Electrostatic Sensitive !2evice When found on cabinets, module subracks or packaging, the symbol shown below indicates that electrostatic sensitive components have been used in this device and the module is thus sensitive to touch. A ESDS can be destroyed by voltages and energies far below those perceived by humans. Such voltages can even occur when a component or a module is touched by a person who is not statically discharged. Components which have been subjected to such overvoltages can usually not be immediately identified as defective since a malfunction may not occur until the module has been in operation for a longer period of time. To be perceived by humans, the following minimum voltages are required: - To be felt - 3500 volts - To be heard - 4500 volts - To be seen - 5000 volts But a fraction of this voltage can already damage or destroy electronic components. Components which have been damaged, overloaded or weakened by static discharge can malfunction temporarily when average technical specifications are deviated from. A few examples are listed below." -- Temperature changes -- Impact -- Jarring -- Changes in stress Only through rigorous use of protective measures and careful adherence to the handling guidelines can malfunctions and downtime of ESD modules be effectively prevented. @ Siemens AG E-1 ESD Guidelines 2 When Does a Static Charge Occur? You can never be absolutely certain that you yourself or the materials and tools you are using are not electrostatically charged. Small charges of up to 100 V are common but these can increase to 35,000 V in a very short time! Examples: - Walking on carpeting - Walking on plastic flooring - Sitting on upholstered chair - Unsoldering device made of plastic - Plastic coffee cups - Plastic covers - Books and pads with synthetic binding up to 35000 v up to 12000 v up to 18000 V up up up to to to 8000 V 5000 v 5000 v up to 8000 V Important Protective Measures Against Static Charging 3 Since most plastics have a strong tendency to charge, it is imperative that they be kept away from sensitive components. Be sure to provide good grounding of people, your workplace and the packaging when working with electrostatic sensitive components. Handling ESD Modules 4 As a matter of principle, electronic modules should not be touched unless the work to be performed on them makes this absolutely necessary. Components should not be touched unless - you are continuously grounded with an ESD bracelet or - you are wearing ESD shoes or ESD shoe protective grounding strips on an ESD floor. Before touching an electronic module, your own body must be discharged. The easiest way to do this is to touch a conductive, grounded object (e.g., blank metal parts of switching cabinets, water pipes, etc.) immediately prior to touching the component. Modules should not come in contact with chargeable and highly insulating materials (e.g., plastic foil, insulating tabletops, synthetic fiber clothing). Modules should only be placed on conductive surfaces (e.g., table with ESD covering, conductive ESD foam, ESD packaging bag, ESD shipping container). 9 Do not allow modules in the vicinity of CRTs, monitors or television sets (minimum distance to the screen >10 cm). E - II @ Siemens AG ESD Guidelines Required ESD protective measures are shown in the figure below. o b a f -- -- 5 t a Conductive floor b ESD table c ESD shoes d ESD shop coat e ESD bracelet f Grounding connection of the cabinets Measuring and Modifying ESD Modules Measurements may not be performed on the modules unless - the measuring device is grounded (e.g., with protective conductor) or - the measuring head is briefly discharged (e.g., touching blank metal part of the controller housing) prior to measuring when using a floating measuring device. For soldering use only a grounded soldering device. 6 Shipping ESD Modules As a matter of principle, modules and components must always be stored or shipped in conductive packaging (e.g., metallized plastic boxes, metal cans). When packaging is not conductive, the modules must be wrapped in conductive material prior to packaging. For example, conductive foam rubber, ESD bags, household aluminum foil or paper can be used (never use plastic bags or foil). Be sure that the conductive packaging of modules with built-in batteries does not touch or short circuit the battery connections (if necessary, cover the connections with insulating tape or material beforehand). @ Siemens AG E - Ill Notes on Safetv Notes on Safety for the User 1 General Information This manual contains information required for operation of the described products in accordance with their intended applications. The manual is written for qualified personnel who have received special training or have adequate knowledge of measuring, and closed and open loop control technology (subsequently called automation technology). Safe installation and commissioning, and safe operation and maintenance of the described pro- ducts are dependent on a knowledge of the safety notes and warnings contained in this manual and correct observation of same. Only qualified personnel as described in item 2 have the specialized technical knowledge required to fully understand the safety notes and warnings as stated in this manual, to interpret this information correctly in concrete situations, and to put this information to use in actual practice. This manual is a permanent part of the scope of delivery even if a separate order is required for logistics reasons. Forclarity's sake, this manual does not contain all details concerning all models of the described product, and cannot cover every conceivable setup, and type of operation or maintenance. Contact your local Siemens office if you desire additional information or if special problems arise which are not co- vered in sufficient detail by this manual. In addition, be aware that the contents of this product documentation do not constitute a part of a previous or existing agreement, promise or a legal relationship, and are not intended to alter same. All obligations on the part of Siemens are based on the respective purchase order which also contains the complete and solely valid warranty provisions. The information in this manual neitherwi- dens nor restricts these contractual warranty regulations. 2 Qualified Personnel Unqualified work on the device/system or noncompliance with warning notes contained in this manual and warnings posted on the device/system cabinet can cause severe personal injury or property damage. For this reason, only sufficiently qualified personnel may perform work on this device/system. The following personnel are considered qualified for the purposes of the safety-related notes in this manual or on the product itself: . Either programming personnel familiar with the safety concepts of automation technology Oroperating personnel who have been instructed in the handling of devices used in automation technology, and who are aware of the portions of this manual covering operating Or maintenance and service personnel who have been trained to make repairs on devices used in automation technology, and are authorized to commission, ground and label electrical circuits and devices/systems in accordance with safety standards. ~ Siemens AG s-l Notes on Safety 3 Notes Concerning Danger The following warnings are provided for your personal safety and for the prevention of damage to the described product or connected devices. Notes on safety and warnings to avoid endangering the life and health of users or maintanence personnel and to prevent prope~ damage are indicated as shown below. The terms used in this manual and the notes on the products themselves have the following meaning: CEEl DiEEl Indicates that loss of life, severe personal injury or substantial property damage W result if proper precautions are not taken. indicates that loss of life, severe personal injury or substantial property damage cm result if proper precau- tions are not taken. I-!w_l Indicates that minor personal injury or property damage can result if proper precautions are not taken. Important information concerning the product, handling of the product or that part of the manual which requires particular attention. I Attention I Corresponds to the above definition for "note" or "caution" when used in this manual for information concerning safetv. . s - II @ Siemens AG Notes on Safetv 4 9 Operation in Accordance with Intended Use The device/system and/or the system components may only be used for the applications contained in the catalog and technical specifications, and only in combination with devices or components of other manufacturers which have been recommended and/or approved by Siemens. The described rxoduct has been develo~ed, manufactured, tested and documented in compliance with applicable safety standards: Under normal circumstances, the product will not damage human health or property if the described handling regulations and safety notes concerning programming, installation, operation in accordance with intended use, and maintenance are adhered to. A! / . Warning \ When the housing or the protection against accidental contact is removed, or when the system cabinet is opened, certain parts of these devices/systems which can contain dangerous voltages become accessible. Work on this device/system may only be performed by appropriately qualified personnel. This personnel must be thoroughly familiar with all sources of danger and maintenance measures as specified in this manual. Correct and safe operation of the product requires proper shipment, storage, setup and installation, and careful operating and maintenance. Notes on Programming and Installing the Product 5 Since the Droduct is normallv used as a Dart of a larger svstem or plant, these notes are intended as a guide to safe integration of the product into its e;virofiment. " The following facts require particular attention. A ! Note Even when devices of automation technology are designed to provide maximum conceptual safe~ (e.g., multi-channel setup), it is still absolutely essential to adhere precisely to the instructions in this manual since safety measures built into the device/system to prevent dangerous errors can be rendered useless by improper handling; incorrect handling can also create additional danger sources. @ Siemens AG s - Ill Notes on Safetv Notes on installation and maintenance of the product - based on the application - are listed below. A , Warning a The safety and accident prevention regulations applicable to the specific application must be adhered to. Built-in devices for housings or cabinets may only be used and operated when completely installed in the housing or cabinet; desktop or portable models may only be used and operated when the housing is closed. A power disconnector switch or a fuse must be provided in the building installation for facilities with a fixed connection (stationary devices/systems) without all-pole power disconnector switches and /or fuses. The facility must be connected to a protective conductor. The grounded protective contact electrical outlet for devices/systems with permanently connected, non-removable connection lines and without all-pole power disconnector switches must be installed near the device and be easily accessible. Before commissioning devices operated with power network voltage, check to determine whether the set nominal voltage range matches the local power vol- tage. When a 24-V supply is used, a reliable electrical separation of extra low vol- tages must be provided. Use only powerpacks manufactured in accordance with IEC 364-4-41 or HD 384.04.41 (VDE 0100, part 410). Fluctuations or variations of the power voltage from the nominal value may not exceed the tolerance ranges stated in the technical specifications. Otherwise the occurrence of malfunctions and dangerous states on the electrical module systems cannot be excluded. Measures must be provided by which an interrupted program can be properly restarted aftera drop in voltage or a power loss. This must not cause dangerous operating situations even for short times. If necessary, "emergency OFF" must be forced. "Emeraencv OFF" svstems in accordance with EN 60204 IEC 204 (VDE 01 13) must r~mai; effectiv; in all operating modes of the automation syste'm. Releas~ ing the "emergency OFF" system must not cause uncontrolled or undefined restarts. Caution . Installation of connection and signal lines must be such that inductive and capacitive interferences do not affect the automation functions. Installation of automation systems and their operating components must be such that they are sufficiently protected against accidental activation. . Appropriate safety measures must be provided on the 1/0 coupling of the hardware and software to prevent a line or wire break from causing undefined states in the automation system. s - Iv @ Siemens AG Notes on Safetv Active and Passive Errors of an Automation System 6 Depending on the task to be performed by an electronic automation system, both active and passive errors can bedangerous errors. In a drive control system, for example, theactive error is usually dangerous since it can cause the drive to be switched on. In contrast, a passive error in a message function can prevent a dangerous operating state from being reported. The distinction between possible errors and their classification as dangerous or not dangerous based on their task is impottant to all safety measures concerning the-delivered product. A Warning ! Everywhere where errors in the automation system can cause substantial pro- petty damage or even personal injury (i.e., can be dangerous errors), additional external measures must be taken or systems created which will ensure or force safe operation when an error occurs (e.g., with an independent limit value switch, mechanical locks, etc.). 7 Maintenance and Repair Procedures When measurements or tests must be performed on an active device, the specifications and instructions contained in accident prevention regulation VBG 4.0, and 58 "Permissible Deviations during Work on Active Parts" in particular, must be complied with. Suitable electrical tools must be used. , Warning A / 6 \-- Repairs on an automation system may only be performed by Siemens Service personnel or by repair shops authorized by Siemens. When replacing parts or components, use only parts contained in the spare parts list or listed under the section on spare parts in this manual. Unauthorized opening and faulty repairs can result in death or severe personal injury, and substantial property damage. Before opening the device always pull the power plug or open the disconnection switch. When replacing fuses, use only the types specified in the technical specifications or the maintenance instructions of this publication. Do not throw batteries in an open fire and do not perform soldering on the body of the battery. Danger of explosion (maximum temperature of 100 C). Do not open or recharge lithium batteries or batteries containing mercury. When replacing, use only the same types. Always dispose of batteries or accumulators at a special waste collection point. Use of monitors: Faulty work (particularly changes in the high-voltage or installation of another type of picture tube) can result in increased emission of X-rays. A device which has been thus modified no longer meets certification criteria and may not be operated. -1 Theinformation inthis manual ischecked atregular intervals toensurethatdata iscurrent and correct. Theinformation can be changed at anytime without special notification. The manual contains information which is protected by copyright. Reproduction or translation into other languages is prohibited without prior written permission from Siemens. @ Siemens AG s-v ENVIRONMENTAL PROTECTION IN ACTION Information Concerning Packaging Material/Notes on Disposal Dear Customer ! Our high-quality products cannot reach you safely without effective protective packaging. The size of the packaging is kept to an absolute minimum. All our packaging materials are harmless to the environment and can be disposed over without danger. Wood is not chemically treated. Cardboard is made primarily of waste paper which can then be torn up and given to a waste paper collection. Sheeting is made of polyethylene (PE), tapes of polypropylene (PP) and CFC-free padding of foamed polystyrene (PS). These materials are pure hydrocarbons and can be recycled. Please dispose of these valuable secondary raw materials at a recycling center. Recycling saves raw materials and cuts down on the amount of refuse. Ask your city administration for the address of the recycling center nearest you to dispose of packing materials and discarded devices. Thank you for your help ! SIEMENS Warning Risks involved in the use of so-called SIMATIC-compatible facture modules of non-Siemens manu- "The manufacturer of a product (SIMATIC in this case) is under the general obligation to give warning of possible risks attached to his product. This obligation has been extended in recent court rulings to include parts supplied by other vendors. Accordingly, the manufacturer is obliged to observe and recognize such hazards as may arise when a product is combined with products of other manufacture. For this reason, we feel obliged to warn our customers who use SIMATIC products not to install so-called SIMATIC-compatible modules of other manufacture in the form of replacement or add-on modules in SIMATIC systems. Our products undergo a strict quality assurance procedure. We have no knowledge as to whether outside manufacturers of so-called SIMATIC- compatible modules have any quality assurance at all or one that is nearly equivalent to ours. These so-called SIMATIC- compatible modules are not marketed in agreement with Siemens; we have never recommended the use of so-called SIMATIC-compatible modules of other manufacture. The advertising of these other manufacturers for so-called SIMATIC-compatible modules wrongly creates the impression that the subject advertised in periodicals, catalogues or at exhibitions had been agreed to by us. Where so-called SIMATIC-compatible modules of non-Siemens manufacture are combined with our SIMATIC automation systems, we have a case of our product being used contrary to recommendations. Because of the variety of applications of our SIMATIC automation systems and the large number of these products marketed worldwide, we cannot give a concrete description specifically analyzing the hazards created by these so-called SIMATIC-compatible modules. It is beyond the manufacturer's capabilities to have all these so-called SIMATIC- compatible modules checked for their effect on our SIMATIC products. If the use of so-called SIMATIC- compatible modules leads to defects in a SIMATIC automation system, no warranty for such systems will be given by Siemens. In the event of product liability damages due to the use of so-called SIMATIC-compatible modules, Siemens is not liable since we have taken timely action in warning users of the potential hazards involved in so-called SIMATIC-compatible modules. " Table of Contents R 11/92 Table of Contents 1 General Function Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 1 1.1 1.2 1.3 1.4 1.5 Short Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 Application Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -2 HardwareDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -3 Process Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -12 CommunicationwiththeSIMATIC S5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -22 2 Hardware Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 - 1 2.1 2.2 2.3 Location ofthe Setting Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 Settingthe DILSwitches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Settingthe Plug-lnJumpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 3 SoftwareSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 - 1 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 Select Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Load Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 Interrupt Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 CounterVaiueRegister(CVR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 lnterruptEnable Register (lFR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11 lnterruptlnformationRegister(llR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12 Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 Parameter Registersand Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16 Overviewofthe RegisterAddresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 4 Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 - 1 4.1 4.2 4.3 4.4 4.5 4.6 Whatlslnterrupt Processing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Reaction Times During Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 InterruptSources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 GuidelinesforlnterruptProcessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 Hysteresisofthe lnterruptValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 5 CommissioningtheCounter 5.1 5.2 5.3 5.4 5.5 5.6 Commissioning Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 Startup Behaviorofthe Counter Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 RESET Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Evaluation ofthe Status Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5 Changing the Direction ofCounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8 Overviewofthe Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 IP281 EquipmentManual @SiemensAG 1992, OrderNo: 6ES5998-0KP21 Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 1 Tab/e of Contents R 11/92 6 Operating Modes and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 - 1 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 CounterSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Autonomous Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 CombinationOperating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17 Handling theCounters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23 Gate Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-30 Method ofOperation of the Digital Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-34 Block Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-40 7 Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 - 1 7.1 7.2 7.3 7.4 7.5 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1 Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 Cyclic Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 InterruptProcessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7 8 Technical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 - 1 8.1 8.2 8.3 8.4 8.5 8.6 8.7 CounterInputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1 Counting Frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 PowerSupply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3 Environmental Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 lnWhich Slots CantheCounter Module Be Operated? . . . . . . . . . . . . . . . . . . . . . 8-5 Connection Cablesfor incremental Encoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 Requirements onthelnputSignals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10 Definition ofTerms Index II lP281 EquipmentManual @SiemensAG1992, 0rderNo:6ES5 998-0KP21 .. E- I Guidelines for Handling Electrostatic Sensitive Devices (ESD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. E-I S- I Notes on SafetyfortheUser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . s-I Introduction Setup of the Manual This equipment manual is intended as an aid to installing and operating the 1P 281 module. Before starting to work with the module, take thetimeto Iookthrough this equipment manual. You can start by looking up passages which are of particular interest to you. The goal is to obtain an overview of the information provided. The individual sections are self-contained and provide blocks of information on the following subjects, - Installation - Commissioning - Handling Sections 2,3 and 6 contain information on special tasks which you will have to perform when preparing the module for operation. Abbreviations Abbreviations which are not part of everyday usage are written out in full the first time they appear. In addition, a list of all abbreviations is provided in the "Definition of Terms" at the end of the manual. Cross References Cross references to parts of other sections are not made unless the repetition of facts would require too much space and it can be assumed that the description at another location is sufficient. Only the applicable subsection number is given for cross references to parts of other sections. Example: (+ section 2.1) 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 Principle of Operation of a Counter Module Counting is primarily the acquisition and summation of events. In the world of electronics, this is the summation of pulses. Two directions of counting are available. Counting up Binary (Decimal =4) When counting up, the pulses are added (to a start value in some cases). This can be used, for example, for simple acquisition of a piece count. Counting down Starting with a start value which you have stored in a register (memory location) of the 1P 281, the counter is decremented by the number of input pulses. I I Down counter m 5 input pulses WI I Binary L 000011111 I (Decimal = 15) 0001 0100 (Decimal = 20) This can be used, for example, to count out an exact number of pieces and then package them. The counter is provided with an output signal here which can be used, for example, to close a valve when counter status zero is reached, 2 1P 281 Equipment Manual @SiemensA(31992, order No: 6ES5998-0KP21 Counting with software start (or software stop) It is often necessary to link the pulses (depending on other input variables) starting at a defined point in time, and then use this group information to start or stop the counter. Input pulses up counter t J software start (Decimal =2) This can be used, for example, if you know that the characteristics (differences in shape, color, material or other differences) of the first products will be different from the serial product. Counting with hardware gate control If a hardware signal is to start a high-speed counting procedure directly from the system (i.e., from the process), this signal is best applied directly to the gate of the counter. This permits the counter to be started without loading the S5 cycle. Input pulses 1 Counter -- A ::'~5 signal `ATE Binary 0000 0011 (Decimal =3) A defined stop of the counting procedure can also be performed with the gate. 1P 281 Equipment Manual @ Siemens AG 1992, order No: 6E.S5 998-I)KP21 3 Application Areas of the 1P 281 The 1P 281 counter module permits the acquisition and conditioning of counting pulses up to a counting frequency of 250 kHz. Why is such a conditioning module required when STEP5 programmable counters are already available for all programmable controllers? These software counters have limits. To count 50 Hz pulses, for example, the programmable controller must process the counter program portion at time intervals of less than 10 msec. (Twice the "processing frequency" is required since the software counter must also acquire the falling edge of the counting signal in order to be able to recognize the rising edge.) - Multiple calling of the counter program portion (with direct access to the periphery) - Counting input as interrupt input When a software counter is used as an interrupt program, the sampling time limit of the signal is shortened to the run time of the longest individual block. This applies particularly to the use of input module 432. The delay time of the input filter of this module can be shortened to 0.3 msec. Theoretically, this makes it possible to acquire frequencies up to approximately 1.5 kHz. However, the operating system cannot recognize the pulses since the interval between two signal edges is too small (i.e., all counting pulses are not acquired). Considering the above arguments, software counters and the 1P 281 conditioning counter module can be used for the following application areas. Low frequencies are counted with software counters. Higher frequencies (up to 250 kHz) are counted with special counter modules such as the 1P 281. There is no clearcut boundary between the two methods (between 50 Hz and several 100 Hz). 4 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 The 1P 281 offers additional advantages which speak for the use of this module. Depending on the degree of expansion, the module is equipped with one or two counters. The counters can be used together or separately. The external addressing of counting gate inputs offers additional ways to start and stop the counters. Start values can be specified for the counters by the S5 program. The point in time at which these values are loaded in the counters can be specified by the S5 program or directly by the external signals. Each counter can report events (e.g., overflow or end of counting). This message can be both an interrupt to the programmable controller, and an external hardware output. The counter module is used as the connecting element between high-speed events in the process, and the program in the programmable controller. c Use of the 1P 281 counter module requires that the following steps be performed. 1. Analysis of the counting task 2. Hardware settings (jumpers and DIL switches) 1P 281 Equipment Manual @ .%TIWflS AG 1992, Order No: 6ES5 998-0KP21 9 3. Parame- Process Analysis of the Counting Task There are many ways to adapt the 1P 281 to the counting task. The following questions must be answered by the analysis of the counting task. . Which encoder is to be used? -- What counting range is required? -- What counting frequency is required? -- Is this a one-time counting procedure or is the counting procedure repeated continuously? -- Is the counting procedure to be controlled by a hardware or software gate? -- Are reactions outside the module to be triggered when certain values are reached? -- Is the combination of two counters useful? -- Is the counting procedure to begin at a certain value? -- Is the counting procedure to stop at a certain value? After all these questions have been answered, the module can then be set for your particular application as shown below. - Hardware settings and - Parameterization 6 1P 281 Equipment Manual @ siOIIWflS AG 1992, Order No: 6ES5 998-0KP21 Hardware Settings El 1.... The 1P 281 counter module is equipped with one or two counters. Each counter can be set separately. The hardware settings described in section 2 are used to adapt the counter module to specific counting applications. Plug connectors on the front of the module are used to connect the encoder inputs, the digital inputs and the digital outputs. It is easiest to use prefabricated cables. The conditions described in section 8.7 concerning the time relationships of the input signals (e.g., pulse widths and pulse sequences) must be adhered to. Parameterization The 1P 281 counter module is set via various registers for the counting task. The registers are written via the programmable controller S5 commands. 1P 281 Equipment Manual @ Siemens AG 1992, order No: 6ES5 998-I)KP21 General Function Description R11192 1 General Function Description 1.1 Short Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 1 1.2 ApplicationArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 HardwareDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -3 Mechanical Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -3 DiagnosticLEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -5 Plug ConnectorAllocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -7 Functional Setupofthe Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -10 1.4 1.4.1 1.4.1.1 1.4.1.2 1,4.2 1.4.3 1.4.4 Process Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -12 EncoderInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 13 24 VEncoderlnterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 14 5VEncoderlnterface inAccordancewith RS422 . . . . . . . . . . . . . . . . . . . . . . . . . 1 -17 Digital lnputs(Dl) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -19 Digital Output (DQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -20 Voltage Supply forlncremental Encoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -21 1.5 CommunicationwiththeSIMATIC S5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 -22 IP281 Equipment Manual @.SiemensAG 1992, @derNo: 6ES5998-0KP21 l-l General Function Description R 11192 1 1.1 General Function Description Short Description The 1P 281 is a counter module for use in SIMATIC S5 controllers. It is modular in design. The IP281 consists of a basic module with a counter for direct connection of incremental encoders, and an optional plug-in submodule containing a second counter with the same specifications. Use of the second counter increases the range of applications. The 1P 281 is a hardware module with a complex gate array in which all counting functions and the bus interface are integrated. It is operated in the 1/0 area of the SIMATIC S5. Access times are very short since the S5 uses simple transfer commands to access all registers of the 1P 281 directly. For example, a 16-bit counter value can be read by the CPU 9446 in less than 5.6 psec. This makes the 1P 281 also suitable for rapid, closed-loop control applications among other things. The 1P 281 is equipped with the following features. 9 One-time, two-time and four-time evaluation of the encoder signals Operation in 16 or 32-bit mode Choice of positive or positive and negative counting range Loading the counters with defined, initial values Comparison per counter with an interrupt value (comparator) Transfer of values from counter 1 to counter 2 as interrupt or load value Gate control Gate start, gate stop and setting via digital inputs Direct triggering of control procedures outside the module via digital outputs Possible connection of incremental, 24 V encoders or 5 V (RS 422) encoders with two pulse trains displaced by 90" Possible connection of directional encoders Encoder supply via the module (24 V standard, 5.2 V optional) 1P 281 Equipment Manual @ Siemens AG 1992, Order No:6ES5998-OKP21 1-1 R 11/92 General Function Description 1.2 Application Area The 1P 281 module is designed for use in SIMATIC S5 systems, and can be used in the following programmable controllers. PLC S5-115U (CPUS 941 A/Bto 944A/B) PLC S5-135U (CPUS 922, 928A and 928B) PLC S5-155U (CPUS 922, 928A, 928B, 946 and 947) PLC S5-115H (CPU 942H) PLC S5-155H (CPU 946R/947R) Ordering notes The 1P 281 counter module is available under the following order numbers. 1P 281 counter module with 24 V encoder supply: 1P 281 counter module with 24 V and 5.2 V encoder supply: 1P 281 plug-in submodule for counter 2: 1-2 6ES5 281-4UA11 6ES5 281-4UP11 6ES5 281-4UB11 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 General Function Description R 11/92 1.3 Hardware Description 1.3.1 Mechanical Setup Cover from soldered side Figure 1.1: Front plate Cover from component side Setup of the 1P 281 The 1P 281 consists of a basic module and a plug-in submodule available as an optional expansion. Basic Module -- Double Europe format: 233 mm x 160 mm -- Mounting width: 1 1/3 SEP -- Front plate: plastic with diagnostic LEDs and connector elements -- Plastic covering on both sides Counter 1 is included on the basic module. Plug-in Submodule - Dimensions: 90 mm x 90 mm Counter 2 is included on the plug- in submodule. IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 1 -3 R 11192 General Function Description Make the required hardware settings on the plug- in submodule prior to Mounting the plug-in submodule installation (-t section 2.3). The plastic covering must be removed (four screws) before the plug-in submodule can be installed. The plug-in submodule is equipped with four plastic distance pins. When inserting the submodule, all pins must snap into place in the receptacle holes. The plug-in submodule can be removed manually from the basic module. A ! Caution To avoid damaging the module, do not use tools to remove the plug-in submodule. After installation, replace plastic coverings and screw down. 1-4 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 General Function Description R 11/92 1.3.2 Diagnostic LEDs Eight (8) LEDs are installed on the front plate. Readiness indication for the module Error indication for the module Counter running indication Direction indication Status indication for digital output Indications for counter 1 Indications for counter 2 Encoder interface Counter 2 Digital inputs Digital output Counter 2 Encoder interface Counter 1 Digital inputs Digital output Counter 1 24 V Figure 1.2: SUp@y Front plate with indication and connector elements 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 1-5 R 11/92 General Function Description Description of the Diagnostic LEDs RUN LED(Running) These two LEDs indicate that the module is ready for operation or that ERR LED (Error) malfunctions have occurred. Indication RUN o I Meaning ERR Voltage supply error (of S5) o : RESET is active. Module is operating correctly. Parameterization error or wire break CR LED This LED indicates the status of the applicable counter. (Counter running) Indication 1-" *o t 1 DIR LED (Direction) I Status of the Counter CRS = 1 or CRS changing very quickly; counter is counting at high speed. I CRS = O (RESET status) Flashing CRS changing; counter is counting at low speed. This LED indicates the direction of counting. When the encoder is stationary, the direction which was last indicated is retained. Direction of Counter Indication p `(LED for counter 2 goes on even when the plug-in submodule is not inserted.) * t SO LED (Status output) 0 Down This LED indicates the status of the digital output. Indication * 1 1-6 1 0 I Status of the Digital Output 1 Active (24 V on the digital output) (LED for counter 2 goes on even when the plug-in submodule is not inserted.) I Inactive (O V on the digital output) IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 I General Function Description R 11/92 1.3.3 Plug Connector Allocation S5 interface, basic The basic plug connector (48-way, multi-pointterminal strip, DIN41612, model F) is located on the back of the module. Its allocation is shown plug connector X l below. d b z Signal Signal Signal 2 Ml 4 PESP 6 ADB O 8 ADB 1 10 ADB 2 hkM~ 12 ADB 3 m ADB 4 5V RESET DB O 14 I m 16 TFiE ADB 5 DB 1 18 IUc ADB 6 DB 2 20 m ADB 7 DB 3 22 ADB 8 DB 4 24 ADB 9 DB 5 26 ADB 10 DB 6 28 ADB 11 DB 7 30 BASP 32 Ml 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 I I I I 1-7 R 11/92 General Function Description Encoder inputs, plug connectors X5 and X7 Type of plug connector: 15-way, sub D socket with screw lock The pin allocations of plug connectors X5 (for counter 1) and X7 (for counter 2) are identical. @ 15 ; ; 8 ~o ~o ~o 9 0 1 s 1 5 V Encoder Signals in Accordance with RS 422 Pin 6 ~1 Designation 5.2 V Meaning 5.2 V encoder supply (option) GND Reference potential of the module (S5 bus) 10 N Zero marking pulse (N) 11 N Zero marking pulse (~) 12 E Counting signal (track B) 13 B Counting signal (track B) 14 x Counting signal (track Z) 15 A Counting signal (track A) 24 V Encoder Signals Pin Designation Meaning 1 A* Counting signal (24 V, track A*) 4 B* Counting signal (24 v track B*) 5 24 V 24 V encoder supply 7' GND Reference potential (24 ~ 8 N* Zero marking pulse (24 ~ 9 RE Load resistance for A*, B* and N* 1 Change the jumper so that the reference potential on pin 7 corresponds to the-connected encoder (+ sections 1.4.1 and 2.3). Pins 2 and 3 are not used. 1-8 IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 General Function Description R 11/92 Type of plug connector: 8-way, pin plug connector with screw connection Digital inputs and outputs, plug con- for the individual leads. nectors X4 and X6 The pin allocations of plug connectors X4 (for counter 1 ) and X6 (for counter 2) are identical. Designation 24 V Sllppiy, f.?hlg connector X3 Meaning 1 STA Gate starl input 2 o Vefiol Reference potential for digital input 3 STO Gate stop input 4 o Vefiol Reference potential for digital input 5 SET Set input 6 o ve~, Reference potential for digital input 7 DQ Digital output 8 O v@oQ Reference potential for digital output Type of plug connector: 2-way, pin plug connector with screw con- nection for the individual leads Designation ml 2 D Meaning 24 Veti 24 V supply voltage o vem4 External reference potential IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 1-9 R 11/92 General Function Description Functional Setup of the Module 1.3.4 The 1P 281 module provides the hardware for counting with one or two counters. It operates without a separate processor and represents only a slight load for the SIMATIC S5. The necessaty logic and the two, 16/32-bit counters are implemented in a gate array (AW. Encoder input RS 422 Zero mark. pulse + N~" + + \ Count. signal A* +-< * 7 f Encoder input 24 V Counter 1 Set input f Digital inputs B = SET *< I Digital output d Digital output DQ ~++ " S5 interface .------ ,------------------------------. -- -- -- . Data 8 bits F Encoder input RS 422 3 I I a) ,. Counter 2 I I I Digital I inputs ( Set input Jr m SET" +< ~ b *; : Gate start input STA ~ Z* { Gate stop I I1 Dlgltal . . output * input STO +"< 4 Digital L------------ --------------------.. Figure 1.3: 1 - 10 > Plug-in submodule (optional) " output DQ >4+ .------ - Function elements of the 1P 281 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 R 11/92 General Function Description The following flowchart shows the principle of operation of a counter. It indicates the most important hardware components and how the registers affect the counter, See section 6.8 for a detailed diagram. S5 bus I * 1 l-h Control digital output DQ STA Digital STO inputs SET L Figure 1.4: , Principle of operation of a counter in the 1P 281 1P 281 Equipment Manual @ Siemens AG 1992, (Jder No: 6Ef35 ~8-of(p21 1 - 11 R 11192 General Function DescriLXion 1.4 Process Interfaces Each counter is equipped with the following inputs and outputs as the interface to the process. Encoder interface The encoder interface can be set to 24 V connection or to 5 V connection (RS 422). This is perfromed with plug-in jumpers (+ section 2.3 for the hardware settings). The foIlowing signals are evaluated. - AXor A* Counting pulse train, track A A* for 24 V signals -- BE or B* Counting pulse train, track B B* for 24 V signals -- N~ or N* Zero marking pulse N, N* for 24 V signals Digital inputs Three digital inputs separated by optocouplers are available. - STA Gate start input This input is also used during level control to stop the counter (-+ section 6.6.3). - STO Gate stop input This input must be low for level control (+ section 6.6.3). - SET Set input (preliminary contact) (e.g., proximity switch) Digital output 1 - 12 - DQ 24 V digital output 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 General Function Description R 11192 Encoder Interface 1.4.1 Theencoderinterface can be operated with either24V level or5Vlevel (RS 422). Plug-injumpers X35 (counter 1 ) and X 45 (counter 2) are used to make the switch-over. A x RS 422 input : : Multiplexer GND I 0+0 11'L 0 A 0 B 0 N A, 24 V input B* X35/x45 N* GND o 1 ? 2 Counter 1 Counter 2 Allocation Selected Interface x35 x45 1-2 For 24 V encoder x35 x45 2-3 For 5 V encoder in accordance with RS 422 h X391X49 3 Reference potential The 5 V area and the 24 V area are free-floating. To insure that this separation is retained, the corresponding reference potential must be circuited on pin 7 of the encoder interface depending on the"encoder selected (-t section 2.3, selecting the reference potential). Counter 2 Allocation I Reference Potential x39 x49 1-2 For 24 V encoder x39 x49 2-3 For 5 V encoder (RS 422) Counter 1 A ! Caution Incorrectly inserted jumpers (e.g., S5 reference potential for 24 V encoders) can lead to interference caused by grounding loops. In addition, potential isolation between the 24 V encoder inputs and the S5 backplane is lost. Status on delivery: Jumper 1-2 inserted + reference potential for 24 V encoder 1P 281 Equipment Manual @ Siernens AG 1992, @jer No: 6E&jgg8-r)Kp21 1 - 13 R 11/92 General Function Description 1.4.1.1 24 V Encoder Interface The 24 V encoder interface includes the inputs for the three counting signals A*, B* and N*, a connection for load resistances and the encoder supply. Signal inputs The inputs are potentially isolated from the S5 bus and the digital inputs via optocouplers. The three encoder inputs are non-floating relative to each other. Encoders with two pulse trains (A* and B*) displaced by 90 can be connected. Each input is equipped with anRC filter for the suppression of interferences. Plug-in jumpers (--t section 2.3) can be used to set this filter to three limit frequencies @ 250 kHz, s 50 kHz, s 1 kHz). ~ Whenthe module isoperated onthe24Vencoder interface, thereference potential GND must be set for 24 V (+ section 2.3) and the wire break recognition must be switched off. Input circuitry +- RE Vin 5.1 v N VI >. *L * Ov 0 Load resistances 300 - x m C6 1m - I I . -- J1 " L X36 to X36 X46 to X48 TTT' Use the common- connection (pin 9) to apply them to GND or 24 V depending on the type of encoder. A ! Caution 1 - 14 Pin RE on the plug connector must always be connected otherwise inputs A*, B* and N* will be coupled together (i.e., triggering of one input can cause another input to be triggered). 1P 281 Equipment Manual @ .Siemens AG 1992, Order No: 6ES5998-0KP21 R 11/92 Encoder with P switching outputs General Function Description 1 Encoder I A 1 1 1 v+ I J -L P switch --t' 1 A* (24 V,Jrack A IN ~;: ` E B 4 B* (24 V.Jra k B RE N * (24 V~er mark. pulse) 8 RE RE v- 7 N v+ 5 4 Encoder supply #~;: Pin 7 and pin 9 must be jumpered. Encoder with M switching outputs (open collector) Encoder A * ( 2 4 VJack A ) ) L M switch T )R v- `N ) ) E 2 D Encoder supply 4V Pin 5 and pin 9 must be jumpered. Encoder with MP switching outputs (push-pull outputs) Encoder I 1 1 1 , MP switch A B )B * N * [ 2 4 V,Jr&k B] ) v- v- 1V+ ) N V r '24 y~ mark. pulse )R E )GND Encoder ~ `Upp'y Pin 7 and pin 9 must be jumpered. 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 1 - 15 R 11/92 General Function Description Counting with one counting input When only one counting input is used, this must be applied to input A*. The direction of counting is set on counting input B*. There are two ways to do this. - Connect a directional encoder to counting input B* (low level -+ up, high level -t down). - Change the direction of counting by inverting bit 11 in parameter register 1/2 (inversion of counting input B*). The following applies to counting input B* when it is not connected or low: Bit 11 = O -t up, bit 11 = 1 -+ down. Counting mode direction evaluation EVDI (-t section 6.2.2) must be set for counting with one counting input. Encoder supply 1 - 16 The encorder supply (24 V) is provided with potential isolation from the digital inputs and the S5 bus. Potential isolation from the digital output is not provided. The encoder supply is available on connection plug connector X5/X7. It is short circuit proof (--t section 1.4.4). 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6E.S5998-0KP21 General Function Description R 11192 1.4.1.2 5 V Encoder Interface in Accordance with RS 422 The 5 V encoder interface contains the inputs for the three, differential counting signals AJ~, B/E and N~. A 5.2 V encoder supply is available on the module as an option. Signal inputs The signal inputs are provided with potential connected to the S5 bus. The inputs are potentially isolated from the following. - Digital inputs - Digital output - 24 V SUf3@Y Encoders with two, differential signals displaced by 90 (track A/x, track BE and zero marking pulse N~ in accordance with RS 422) can be connected, ~ When the module is operated via the RS 422 interface, the reference potential must be set for the S5 bus (-+ sections 1.4.1 and 2.3). Wire break recognition The inputs are equipped with wire break recognition. This can be switched on and off with plug: in jumpers X34/X44. A A " Y a A" A + D Wire break B e .3 I h B !l!~ NO IT" D+ 7 N ~-----amipnal , 5.2 V encoder SU}PIY l-- ~.----.---- The wire break recognition detects the following errors. 9 Wire break on the signal input Wire break on the inverted signal input Short circuit between signal input and inverted signal input Short circuit between signal input and O VI Short circuit between signal input and 5 VI 1 Is not detected unless the voltage difference between user signal and short circuit <1.1 V. 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 8ES5998-OKP21 1 - 17 R 11192 General Function Descridion When the wire break recognition is active and an error occurs, the error is entered in status register 3 and the ERROR LED goes on. There is one wire break recognition for each counter. The message is retained for the duration of the error. When the wire break recognition is active and counting inputs are open, this causes a wire break message. ~ The wire break recognition must be switched off for unconnected plug connector/unused input X5/X7. The wire break recognition can cause errors when very long connection lines are used. Switch off the wire break recognition if this happens. 5.2 V encoder supply An optional model of the basic module is also available with a short circuit proof, 5.2 V encoder supply on plug connector X5/X7(+ section 1.4.4). This 5.2 V encoder supply cannot be retrofitted later. 1 - 18 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 R 11192 1.4.2 General Function DescriMion Digital Inputs (Dl) Each counter is equipped with three digital inputs. STA = Input, gate start STO = Input, gate stop SET = External set input (preliminary contact) (e.g., proximity switch) The inputs for counter 1 are located on plug connector X4; the inputs for counter 2 are located on plug connector X6 (+ section 1.3.3). The digital inputs are potentially isolated from the following. - S5 bus - Digital output - Encoder interface The digital inputs are 2-way. They are operated with a nominal voltage of 24 V. The function of digital inputs STA and STO is described in sections 6.6.2 and 6.6.3; the function of digital input SET is described in section 6.5.1.2. Each digital input is equipped with an RC filter (for the suppression of interferences) following the optocoupler. Plug-in jumpers (+ section 2.3) can be used to set this filter to three limit frequencies & 250 kHz, < 25-kHz, <100 Hz). Input Circuiting of the Digital Inputs 4 Vin 1.5 k 5.1 V lx Al >- ~ w 300 x Ov 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 1 - 19 R 11192 General Function Description 1.4.3 Digital Output (DQ) Each counter is equipped with one, two-way, digital output with a nominal voltage of 24 V. The digital output for counter 1 is available on plug connector X4; the digital output for counter 2 is available on plug connector X6 (+ section 1.3.3). The digital output can be used to directly trigger processes external to the module. The functions of the diaital outRuts are described in section 6.7. Direct connection of a relay. is possible (maximum Io[d current of 600 mA). ~ The connected relay must be equipped with a free-wheeling diode. Address- ing of DQ 24 V al & BASP Setting of the minimum w Software I pulse enable duration + -- Driver output Freewheeling ~1+ diode RL ~ Status When activated, the output remains active for the minimum pulse duration. This minimum pulse duration can be set to three different times (1Omsec/100 msec/500 msec) for each output indivi- dually (+ section 2.3). If the triggering event lasts longer than the minimum pulse set, the output remains active until the event has disappeared again. The digital output is potentially isolated via optocouplers from the following. - S5 bus - Digital inputs - 5.2 V encoder supply The digital output is supplied by the 24 Vdirectvoltagefed by X3. A P switch is used as the output driver. The digital output is short circuit proof and protected against overload. The digital outputs are disabled after startup of the 1P 281. They are enabled by control register3. The BASP signal is active during an interference, and during startup and stop of the PLC. The BASP signal is used for the S5 as an "EMERGENCY OFF" for the digital outputs. Since certain applications require that the outputs not be switched off when an error occurs, the 1P 281 offers the capability of switching off the BASP function for both digital outputs together (+ section 2.3). Remember that, in such situations, the digital outputs are no longer -- protected by the safety system of the SIMATIC S5. A ! Warning 1 - 20 When the BASP function is switched off, other suitable measures must be provided to ensure that persons and systems are not endangered when the outputs are not switched on. IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 General Function Description R 11192 Voltage Supply for Incremental Encoders 1.4.4 The module is available in the two configurations. - With voltage supply for 24 V encoder - With voltage supplies for 24 V encoder and 5.2 V encoder ~ Thevoltage supply forthe5.2V encoder cannot be retrofitted. ~CLDQtHnAfwmerT o 24 V Fuse -- 3.15 A Fil- ter r - - - - - " Fil- ter ` ::N I 1- ---------- J Optional I~ I) V.,t,g, Supf),y I 24 V encoder supply o o 0 ~~~~~ Voltage supply for 24 V encoder Voltage supply for digital outputs Both encoder supplies are short circuit proof and protected against overload. A diode is used to protect against feedback for the 24 V encoder supply. The supplies for the encoder and the digital outputs are generated from the externally fed 24 V supply. A diode is used to protect the module against polarity reversal of the 24 V supply. A fuse is located on the input of the 24 V supply. The fuse is not triggered unless errors are present on the module. The fuse is not triggered when an output or the encoder supply short circuits since short circuit proof drivers are used for these outputs. The 5.2 V supply is potentially isolated from the external, 24 V supply. The voltage supplies for the encoders are available on the encoder interfaces X5/X7 (+ section 1 .3.3). IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 1 - 21 R 11/92 General Function L3escriDtion 1.5 Communication with the SIMATIC S5 The 1P 281 is an intelligent 1/0 module. It can be addressed in the following areas. - Analog 1/0 area (P area), addresses F080H to FOFFH 2128 to 255 - Expanded 1/0 area (Q area), addresses F1OOH to F1 FFH 20 to 255 The module occupies 8 bytes of input/output address area. The addresses for input and output are identical and can be selected as desired in the above stated address areas. The basic address is set with DIL switch S1 ( + section 2.2). The basic address is always a multiple of eight. Decoding of the addresses depends on the PLC. PLCS5-115U evaluates addresses up to 8 bits; PLCS S5-135U and S5-155U evaluate 12-bit addresses. The type of decoding must beset with the DIL switch (-+ section 2.2) based on the PLC in which the 1P 281 is used. The module is accessed with simple transfer commands (LPB, LPW, LQB, LQW, TPY TPW, TQB, TQW) given by the S5 CPU. The 1P 281 can be used in the individual PLCS with the CPUS listed below. PLCS5-115U - CPUS 941Ato 944A - CPUS 941 B to 944B PLCS5-11 5H - CPU 942H PLC S5-135U - CPU 922 - CPU 928A - CPU 928B PLC S5-155U (in S5-150U mode without "interrupt''/S5-155U mode, full operation) - CPU 922 - CPU 928A/CPU 928B - CPU 946/947 PLC S5-155H (without "interrupt") - CPU 946R/947R PLCS5-115U is not equipped with an expanded 1/0 area. Due to internal synchronization, the 1P 281 increases the command run times by approximately 0.4 psec per byte accessed. The 1P 281 can trigger interrupt processing on the S5 CPU (+ section 4). 1 - 22 1P 281 Equipment Manual @ Siemens AG 1992, orderNo: 6Esgg8-oKP21 Hardware Settings R 11/92 2 Hardware Settings 2.1 Location of the Setting Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 - 1 2.2 Setting the DILSwitches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 2.3 Setting the Plug-ln Jumpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-OKP21 2-1 Hardware Settings R11192 2 2.1 Hardware Settings Location of the Setting Elements Selec[ion of an interrupt line (section 2.2) 1 ---- -------------- Slot for plug-in submodule (see next page and section 1.3. 1) ---- -------------- Ii?E/ x39 \x::, , Selection of the reference potential Pulse duration on x36 x33 the digital output ,.! ,. :, x37 Pi \ Plug-in mx34 X38 \ .. . .: :, .cOgnLn `=4 W/re break .. X30 P \ + NE3 X31 ,, .++,, ;:,<: X32 I jumpers X50 to x55 " must be open (used for internal factoty testing purposes). `F;E~J Selection of the encoder interface wire fuse (section 1.4.4) -J 123 - Pina//ocation of thep/ug-injumpem Setting elements on the basic module 1P 281 Equipment Manual @SiemensA(31992, Order No: GE.% 2-1 99&r)Kp21 R 11192 Hardware Settings Plug-in connectors / \ liiih'X46 setting, 24 V inputs ./ Wire braakrecognition x45 Filter setting, digital inputs o Figure 2.2: X41 Selection of the encoder interface X42 o 1 2 3 Pin allocation of the p l u g - i n jumpars Setting elements on the plug-in submodule Before the plug-in jumpers can be set, the cover must be removed by unscrewing four screws (+ figure 1.1). If settings on the plug-in submodule are to be adjusted, it must first be removed from ~he basic module by hand. A ! Caution To avoid damaging the module, do not use tools to remove the plug-in submodule. After setting the plug-in jumpers, install the plug-in submodule again (+ section 1.3.1). Replace the cover and screw down. 2-2 1P 281 Equipment Manual @ Siemens AG 1992, Order No:6ES5998-0KP21 Hardware Settings R 11/92 2.2 Setting the DIL Switches Address decoding OIL switch S1 is used to set the basic address and select the address and basic address decoding. The register address for read and write accesses of the individual registers is generated from the set basic address and the offset (-t section 3). The module occupies the address area from basic address +0 to basic address +7 in both the input and output area. Switches S1.1 to S1.9 are used to set address bitsAB3toAB11. The address is always a multiple of 8 since address bits ABO to AB2 are fixed. Switch S1 .10 is used to switch between simple address decoding (8 bits) and expanded address coding (12 bits). Status on delivery: all switches "OFF" S1 DEC AB1l AB1O AB9 AB8 AB7 AB6 AB5 AB4 AB3 211 .210 29 2S 27 26 25 24 I I Preceding S5 basic address # Selection of address decoding OFF= Simple address decoding ON = Expanded address decoding 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 2-3 R 11192 Hardware Settings Setting the basic address for PLC S5-1 15U and PLC S5-1 15H PLCSS5-11 5U andS5-115H evaluate only address bits ABO to AB7. Set DIL switch S1 as shown below. Switch Meaning Setting S1 .1 to S1.5 S1 .6 to S1 .9 S1.lo AB3 to AB7 Disregard 12/8-bit decoding Basic address Any OFF Since the 1P 281 is always addressed in the analog 1/0 area when used with PLCS5-115U and PLCS5-115H, possible basic addresses are 80H (128) to F8H (248). Example: Basic address of the module: 090H Qaddress 144 ~ PY144 toPY151 IL 2-4 I Basicaddress= 1 4 1 Setting is fixed. ~ 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 Hardware Settings R 11/92 Setting the basic address for PLCS S5-135U, S5-155U and S5-155H evaluate address bitsAB11 to ABO. Set DIL switch S1 as shown below. PLCS5-135U, PLC S5-155U PLC S5-155H r Switch Meaning Setting S1 .1 to S1 .5 AB3 to AB7 Basic address S1 .6 Selection of area Areas OFF = P area ON = Q area SI.7 to S1.9 AB9toAB11 OFF S1.lo 12/8-bit decoding ON The module can be operated in both the analog 1/0 area (P area) and the expanded 1/0 area (Q area) when used withPLCSS5-135U, S5- 155U and S5-155H. Available basic addresses are listed below. P area: 80H (128) to F8H (248), addresses F080 to FOF8 Q area: OH (0) to F8H (248), addresses F1OO to F1F8 ~ The Q area can only be used in expansion units. 1st example: P area Basic address of the module: ~ Setting is fixed. Selection: Q area = OFF 2nd example: 27 A8H ~ address 168 Q PY168 toPY175 $ 25 24 128 + O + 32 + O + 8 I Basic address = 168 1' 23 Q area Basic address of the module: A8H~ address 168 ~ OYB168 toOY175 ,2' ~ Setting is fixed. Selection: Q area = ON 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 1 2' 25 24 128 + O + 32 + O + 8 I Basic address = 166 23, 2-5 R 11192 Hardware Settings Selecting the interrupt line DIL switch S2 is used to select the S5 interrupt line which triggers the interrupt on the PLC (+ section 4). Only one switch may be set to ON. OFF S2 ON IRD IRC IRB I IRA S5 interrupt lines IRA to IRD OFF: No interrupt ON: Interrupt v"iathe applicable line Status on delivery: all switches OFF 2-6 IP 281 Equipment Manual @ SiemensAG 1992, Order No:6ES59e8-oKP21 Hardware Settinas R 11192 2.3 Setting the Plug-In Jumpers Location of the plug-in jumpers The design of both counters is identical (i.e., the location of the components on the module and the plug-in submodule are geometrically identical). This makes it easier to set the plug -in jumpers. The settings are made with plug-in jumpers X20, X30 to X39 (basic module) and X40 to X49 (plug-in submodule). Plug-in jumper X20 affects both counters. Counter 1 is set with X30to X39; counter 2 is set with X40 to X49. Plug-in jumpers with the same relative position have the same function. ~ Plug-in jumpers X50 to X55 are used for internal factory testing purposes. Leave them open. BASP function for digital outputs Plug-in jumper X20 can be used to switch the EMERGENCY OFF function (BASP) on or off for both counters together (-+ section 1.4.3). II Effect Jumper X20 H+---00------0 1 A! 2 3 Not permitted The digital outputs are switched off when the BASP signal is active. The digital outputs are not switched off when the BASP signal is active. Warning When the plug-in jumper is inserted on 2-3, the digital output is not switched off even when an error occurs. This can lead to destruction of system components and injury to persons. Status on Delivery Jumper X20 ~o 1 1P 281 Equipment Manual @SiemensA(31992, Order 2 3 Effect The digital outputs are switched off when the BASP signal ia active. 2-7 No: 6ES5998-I)KIJX R 11/92 Hardware Settings Setting the input filter The 24 V counting inputs and the digital inputs are equipped with RC filter for the suppression of interferences. These filters can be set individually to various limit frequencies. Input signals and interferences whose frequencies are above the limit frequency are filtered out. Digital inputs Plug-in jumpers X30 to X32 and X40 to X42 are used to set the maximum signal frequency for the digital inputs. I Allocation of the Plug-In Jumpere Counter 1 Counter 2 Gate start input X30 X40 Gate stop input X31 X41 Set input X32 X42 Function Setting the Llmlt Frequency Maximum signal frequency Jumpers X30 to X32 X40 to X42 0 0 0 1 2 3 250 kHz 25 kHz ~o 1 2 3 100 Hz o~ 1 2 3 Status on Delivery I 1 Jumpers X30 to X32 X40 to X42 0 1 0z I Maximum signal frequency 250 kHz +. * Plug-in jumper premounted on pin 3 2 - 8 1P 281 Equipment Manual @ SiemensAG 1992, Order No:6ES5998-0KP21 I Hardware Settings R 11192 24 V encoder inputs Plug-in jumpers X36 to X38/X46 to X48 are used to set the maximum counting frequencies for the 24 V encoder inputs. I Allocation of the Plug-In Jumpere Function Counter 1 Counter 2 Track A X36 X46 Track B x37 x47 Zero marking pulse X38 X46 Setting the Limit Frequencies Maximum counting frequency Jumpers X36 to X38 X46 to X46 0 0 0 1 2 3 250 kHz 50 kHz ~o 1 2 3 1 kHz o~ 1 2 3 Status on Delivery Maximum counting frequency Jumpers X36 to X38 X46 to X48 0 0 1 2 250 kHz ~, * Plug-in jumper premounted on pin 3 Minimum pulse duration for digital outputs Plug- in jumpers X33M43 are used to set the minimum pulse duration for the digital outputs. This is the minimum time a digital output remains active after activation. Allocation of the Plug-In Jumpers x33 Minimum pulse duration, digital output 1 x43 Minimum pulse duration, digital output 2 Setting the Minimum Pulse Duration Minimum pulse duration Jumpers X33iX43 0 0 0 1 2 3 ~o 1 2 3 o~ 1 2 3 Approx. 500 msec Approx. 100 msec Approx. 10 msec Status on Delivery Minimum pulse duration Jumpers X33/X43 0 0z {* Approx. 500 msec 1 * Plug-in jumper premounted on pin 3 1P 281 Equipment Manual @ .%3MEHIS AG 1992, Order No: 6ES5 998-0KP21 2-9 R 11192 Hardware Settinas Wire break recognition Plug-in jumpers X34/X44 are used to switch the wire break recognition on or off for the individual counters (+ section 1.4.1.2). Allocation of the Plug-In Jumpers x34 I Wire break recognition for counter 1 I x44 Wire break recognition for counter 2 I I Setting the Wire Break Recognition X341X44 I 0 0 0 1 2 3 1 2 3 o~ 1 2 3 Meaning Not permitted I Wire break recognition switched off ~o 1 Wire break recognition switched on I 1 The wire break recognition must be switched off when the counter is operated with the 24 V encoder interface. Status on Delivery I Meaning Wire break recognition switched off 2 - 10 1 I ~ The wire break recognition can only be used during operation of the RS 422 interface. x34/X44 I 1P 281 Equipment Manual @ Siemens AG 1992, Order No:6ES5998-0KP21 Hardware Settings R 11192 Selecting the encoder interface (RS 422/24 V) Plug- in jumpers X35M45 are used to select the encoder interface (24 V encoder or 5 V encoder in accordance with RS 422) for the respective counter. Allocation of the Plug-In Jumpera x35 Interface selection, counter 1 x45 Interface selection, counter 2 Interface Selection 0 1 X351X45 0 0 2 o~ 2 Not permitted 3 ~o 1 2 3 1 Selection For 24 V encoder For RS 422 encoder 3 I Status on Delivery X351X45 Selection ~o 1 A 2 24 V encoder selected 3 ! Caution If you switch the encoder interface, you must also switch the reference potential for plug connector X5/X7 otherwise the potential isolation is removed (+ following page and section 1P 281 Equipment Manual @ SiemenS AG 1992, Order No: 6ES5 998-0KP21 2 - 11 Hardware Settings R 11/92 Selecting the Plug- in jumpers X39/X49 are used to set the reference potential for the reference potential encoders. for the encoder The encoder interfaces can be operated as either 24 V interfaces or 5 V (RS422). If the interface is adjusted, the corresponding reference potential must beset to prevent the potential isolation between the 24 V area and the 5 V area from being removed. I Allocation of the Plug-In Jumpers x39 Reference potential for counter 1 (X5) x49 Reference potential for counter 2 (X7) I Reference Potential Selection X391X49 r - I 0 0 0 1 2 3 2 3 I o~ 1 2 3 1 Use 0 Vew4 is connected to pin 7 24 V encoder (X51X7). 0--00 1 Meaning Not permitted I Ml from S5 bus is con- nected to pin 7 (X5/X7). RS 422 encoder A ! Caution /@\ -- Incorrectly inserted jumpers can lead to interferences caused by grounding loops. In addition, the potential isolation of the 24 V encoder inputs to the S5 is lost. I Statua on Delivery x39/x49 ~o 1 2 - 12 2 3 Meaning Use O VeW4 is connected to pin 7 (X5M7). 24 V encoder 1P 281 Equipment Manual @ .SiemensAG 1992, Order No: 6E.% gg8-l)KP21 Software Settings R 11/92 3 Software Settings 3.1 3.1.1 3,1.2 3.1.3 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 Definition ofthe Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 Selectingthe Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Reading and Writing the Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 3.2 SelectRegister . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 3.3 Load Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 3.4 Interrupt Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 3.5 CounterValueRegister(CVR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 3.6 lnterruptEnable Register (lFR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11 3.7 lnterruptlnformation Register(llR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12 3.8 Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 3.9 ParameterRegisters and Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16 3.10 Overview ofthe RegisterAddresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 IP281 EquipmentManual @SiemensAG 1992, 0rderNo:6ES5 998-fjKp21 3-1 Sollware Settings R11192 3 Software Settings 3.1 General 3.1.1 Definition of the Registers Select register Used as an addressing aid for the selection of a register set Global registers Registers containing information for both counters. Global registers are control register 3, status register 3 and the interrupt information register. Control register 3 The general module functions are set here. Status register 3 Indicates the status of the module Interrupt infor- mation register Information concerning the interrupts triggered is stored here. Specific registers Registers which are available for each individual counter Control registers 1 and 2 The control of the respective counter is specified here. Parameter registers 1 and 2 Counting mode, operating mode, counting pulse evaluation, gate control, input behavior of the counting inputs, method of operation of the digtal output, and synchronization are parameterized here for the respective counter. Interrupt enable registers 1 and 2 The interrupt sources which will trigger interrupts are set here for the respective counter. Load registers 1 and 2 A start value can be entered here for the respective counter. Interrupt registers 1 and 2 An interrupt value can be entered here for the respective counter. Counter value registers The respective counter uses these registers as intermediate storage to allow the contents of the counter to be read out. 1P 281 Equipment Manual @ Siernens AG 1992, order No: 6ES5 998-r)Kp21 3-1 R 11/92 Software Settings 3.1.2 Selecting the Registers Principle of selection The registers of the 1P 281 are divided into sets of registers for read and write accesses. Before a register can be accessed, the corresponding register set must be set with the select register (@ section 3.2). The desired register can then be read or written via the register address. Register address The register address consists of the following components. - The basic address set (via DIL switch S1 for the 1P 281) (-t sect. 2.2) and - The offset in the respective register set (-t section 3.2) Register address = basic address + offset ~ Anerror message is notgenerated when an address is accessed which is not assigned to a register. The access is acknowledged with ~ 3-2 1P 281 Equipment Manual @ SiemensAG 1992, Order No:6ES5998-0KP21 R 11192 3.1.3 Software Se ftings Reading and Writing the Registers The registers are read or written via the programmable controller using S5 commands. The permissible commands are found in section 3.10. Writing the registers The use of word commands is recommended for registers which are longer than one byte (load, interrupt and parameter registers) . (Exception: CPU 944, only byte commands are permitted.) The 1P 281 does not accept the values until the last byte is written (access to the byte with the highest offset address of the corresponding register). It is mandatory that the sequence from the lowest address to the highest address (or from the highest byte to the lowest byte) be adhered to to prevent the registers from accepting erroneous values. Reading the registers The contents of the registers are stored intermediately during read ac- cesses. Intermediate storage is performed when the lowest address/ highest byte of the register to be read is accessed. ~ The entire re9ister must be read to obtain avalkj value No other register can be read until the entire register has been read. As soon another readable register is accessed, the new contents are intermediately stored and the old value is lost. Example: Read byte 3 of CVR1 Read byte 2 of CVR1 Read byte 1 of CVR1 Read byte O of CVR1 ~ Value is stored. -t Value of CVR1 is still valid. -+ Value of CVR1 is still valid. ~ Read CVR1 is concluded. Read byte 3 of CVR1 Read byte 2 of CVR1 Read STATUS1 -t Value is stored. ~ Value of CVR1 is still valid. -t Value of CVR1 is lost. STATUS1 is valid. ~ Value is invalid. Read byte 1 of CVR1 It is recommended that registers which are longer than one byte (IIR and CVR) be read with word commands, (Exception: CPU 944: Only byte commands are permitted.) Access via byte commands CPU 944 inPLCS5-115U does not permit word commands. When byte command addressing is used, the access sequence shown below must be adhered to. - Sequence of byte addresses for 2-byte registers: 1st byte address: n 2nd byte address: n+l - Sequence of byte addresses for 4-byte registers: 1st byte address: n 2nd byte address: n+l 3rd byte address: n+2 4th byte address: n+3 1P 281 Equipment Manual @SiemensA(31992, order No: 6ES599&r)Kp21 3-3 R 11/92 Software Setfinw 3.2 Select Register A register set is selected to address the registers for the 1P 281. The allocation of the registers to the ;ets is shown in the following figure. - Select reg. --------- -- --------- -- --------- -- Offset O 1 2 3 Write 4 5 Parameter register 1 Load register 1 6 Parameter 7 register 2 + Reg. Set 3 Reg. Set 2 Reg. Set 1 Reg. Set O IFR 2 Select reg. ----------- ----------- ---------. -- Load register 2 Interrupt register 2 Select reg. -- ----------- Interrupt register 1 Reg. Set 4 ~ Offset O 1 Read IIR 2 Status reg. 1 + 3 Status reg. 2 I 4 5 6 7 .----------- ------ J Counter value register 1 Status reg. 3 I Counter value register 2 When a counter is operated in 16-bit mode, only byte O and byte 1 are used when 4-byte re- gisters are used (i.e., the offset addresses for the load, interrupt and counter status registers are incremented by 2). A register set is selected in the select register. The register set remains selected until a new value is entered in the select register. Register Set Contents of the Select Register o OH 1 IH 2 2H 3 I 4 3H I 4H I The ERROR LED goes on for all other entries. The select register is always addressed with offset address O regardhss of the register set selected. The selec~ register can-not be read back. Caution When a set is selected in the interrupt program (e.g., to read out the IIR), this call causes the current set selection in the cyclic program to be lost. This makes it necessary to save the selected set for all read and write procedures for which the interrupts are not disabled IA/RA). The selected set address must then be saved in a selected memory location and reloaded at the end of the interrupt program. 3 - 4 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 Software Settings R 11192 3.3 Load Register Each counter is equipped with a load register. A defined value (load value), which is used to load the counter for certain events, can be stored in this register. The load register can be written atall times (except with operating mode TCLR). It cannot be read back. The load value is entered as a 16-bit or 32- bit value in the register (depending on the counting mode set). The following methods can be used to enter the values in the load register. - Writing the load register from the PLC - Transfer when in TCLR operating mode (+ section 6.4.3) ~ Load register 2cannot rewritten from the PLC in operating mode TCLR. Contents of the register after RESIX O Load register 1/2 Bw~ 2 Byt~ 3 2S1 . - - - - - - - - 224 I 223. - - - - - - - - 216 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Byte 1 Byte O For counting modes 1 and 3 (16-bit): `8e'ml For counting modes 2 and 4 (32-bit): Offset 4 Byte 3 5 Byte 2 6 Byte 1 7 Byte O n 1P 281 Equipment Manual @SiemensA(31992, Order No: 6ES5998-0KP21 3-5 R 11192 Sotlwfare Seitirws Example: Writing load register 1 (32 bits) Prerequisites: - Load value is in DB 20. DW 10 (high word, bits 31 to 16) DW 11 (low word, bits 15to O) - Counting mode 2 or 4 is selected (i.e., offset= 4). - Basic address of the module: 136 With word commands: L T C L T L T KH 1 Set register set 1 for access to the load register PY 136 } Call data block 20 DB 20 DW 10 PW 140') 1 Transfer load value from DB to the 1P 281 DW 11 PW 142*) ~ With byte commands: L T C L T L T L T L T Example: KH 1 Set register set 1 PY 136 } Call data block 20 DB 20 DL 10 PY 140' \ DR 10 PY 141 * Transfer load value from DB to 1P 281 DL 11 \ PY 142* DR 11 PY 143* I Writing load register 1 (16 bits) Prerequisites: - Load value is in DB 20. DW 11 (bits 15 to O) - Counting mode 1 or3 is selected (i.e., offset= 6). - Basic address of the module: 136 With word commands: L T C L T KH 1 PY 136 } DB 20 DW 11 PW 142' } Set register set 1 Call data block 20 Transfer load value from DB to 1P 281 With byte commands: L T C L T L T KH 1 PY 136 } DB 20 DL 11 PY 142* DR 11 PY 143* } Set register set 1 Call data block 20 Transfer load value from DB to 1P 281 * Register address = basic address + offset 3 - 6 1P 281 Equipment Manual @ SiemensAG 1992, Order No:6ES5998-0KP21 R 11/92 3.4 Software Settings Interrupt Register Each counter is equipped with an interrupt register. A defined value (interrupt value) can be stored in this register and continually compared to the current counting value (hardware comparator). A digital output can be activated (+ section 6.7) or an interrupt generated (+ section 4.4) when the counting value reaches the interrupt value. ~ A digital output must be enabled in control register 3 (+ section 3.9) before it can be activated. An interrupt must be enabled in the interrupt enable register (+ sections 3.6 and 4.4) before it can be generated. The interrupt register can be written at all times. It cannot be read back. The following methods can be used to enter the interrupt value in the interrupt register. - Writing the interrupt register via the S5 from the PLC - Transfer in TCAR operating mode (+ section 6.4.2) ~ interrupt register 2cannot rewritten from the PLC in operating mode TCAR. Contents of the interrupt register after RESH: o Interrupt register 1/2 Byt? 3 B~e 2 I 231. - - - - 1 - - - - 224 223- - - - - - - - - 216 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - . 28 27 - 215- - - - - - - Byte 1 . - - - - - - - 20 Byte O For counting modes 1 and 3 (16-bit): Offset 6 Byte 1 7 Byte O for counting modes 2 and 4 (32-bit): Offset 4 Byte 3 5 Byte 2 6 Byte 1 7 Byte O r 1P 281 Equipment Manual @SiemensA(31992, order No: 6E!% 99& fJKp21 3-7 R 11192 Software Settings Example: Writing interrupt register 1 (32 bits) Prerequisites: - Interrupt value is in DB 20. DW 10 (high word, bits 31 to 16) DW 11 (low word, bits 15 to O) - Counting mode 2 or 4 is selected (i.e., offset= 4). - Basic address of the module: 136 With word commands: L T C L T L T Set register set 2 for access to the interrupt KH 2 PY 136 > register DB 20 Call data block 20 DW 10 PW 140* Transfer interrupt value from DB to 1P 281 DW 11 ) PW 142' ~ With byte commands: L T C L T L T L T L T Example: KH 2 Set register set 2 PY 136 } DB 20 Call data block 20 DL 10 PY 140' DR 10 ) PY 141 * Transfer interrupt value from DB to 1P 281 DL 11 ) PY 142* DR 11 PY 143' / Writing interrupt register 1 (16 bits) Prerequisites: - Interrupt value is in DB 20. DW 11 (bits 15 to O) - Counting mode 1 or 3 is selected (i.e., offset= 6). - Basic address of the module: 136 With word commands: L T C L T KH 2 Set register set 2 PY 136 > DB 20 Call data block 20 DW 11 PW 142* } Transfer interrupt value from DB to 1P 281 With byte commands: L T C L T L T KH 2 PY 136 } DB 20 DL 11 PY 142* DR 11 PY 143* } Set register set 2 Call data block 20 Transfer interrupt value from DB to 1P 281 * Register address = basic address + offset 3-8 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 Software Settings R 11192 3.5 Counter Value Register (CVR) The counter value register (CVR) is used to read out the counter status. It contains either 16 bits (modes 1 and 3) or 32 bits (modes 2 and 4) depending on the counting mode set. The CVRcan be read by the S5 at all times. Thecountervalues can be read asynchronously (each counter individually) or synchronously (counter 1 and counter2 simultaneously (+ section 6.5.3)). With high-byte addressing (byte 1 for 16 bits; byte 3 for 32 bits), the counting value is interme- diately stored in the CVR until the lowest byte (byte O) is addressed and output (+ section 3.1.3). Each counter is equipped with a CVR register. - CVR 1 for counter 1 - CVR 2 for counter 2 Counter value register Byte 2 Byte 3 --231. - - - - - - - - --224 -- I 223. - - - - - - - - 216 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - 28 27 - 215- - - - - - - - Byte 1 - - - - - - - - 20 Byte O For counting modes 1 and 3 (16-bit): -:m OWE Counter 1 Counter 2 For counting modes 2 and 4 (32-bit): Counter 1 Counter 2 `ffset:m OfietiE 1P 281 Equipment Manual @ Siemena AG 1992, order No: 6ES5 99&(jKp21 3-9 R 11/92 Software Settings Example: Reading CVR 1 (32 bits) Prerequisites: - Memory for counter is in DB 20. DW 20 (high word, bits 31 to 16) DW21 (low word, bits 15to O) - Counting mode 2 or 4 is selected (i.e., offset= O). - Basic address of the module: 136 With word commands: L T C L T L T Set register set 1 for access to the counter value KH 1 PY 136 } register Call data block 20 DB 20 PW 136* ) DW 20 Read counter value and store in DW 20/DW 21. PW 138* DW 21 ) With byte commands: L T C L T L T L T L T Example: KH 1 Set register set 1 PY 136 } Call data block 20 DB 20 PY 136* DL 20 PY 137* ) DR 20 Read counter value byte by byte and store PY 138' in DW 20/DW 21 DL 21 ) PY 139* DR 21 ) Reading CVR 1 (16 bits) Prerequisites: - Memory for counter is in DB 20. DW21 (bits 15 to O) - Counting mode 1 or 3 is selected (i.e., offset= 2). - Basic address of the module: 136 With word commands: L T C L T KH 1 Set register set 1 PY 136 ) Call data block 20 DB 20 PW 138* Read counter value and store in DW 21 DW 21 } With byte commands: L T C L T L T KH 1 Set register set 1 PY 136 1' Call data block 20 DB 20 PY 138* DL 21 Read counter value byte by byte and store PY 139' in DW 21 } DR 21 * Register address = basic address + offset 3 - 10 1P 281 Equipment Manual @ .%3MWIS AG 1992, Order No: 6ES5 996-0KP21 Software Settings R 11192 3.6 Interrupt Enable Register (IFR) Each counter is equipped with an interrupt enable register with which the interrupt sources can be enabled or disabled (-t section 4.4). "'' t"; Wmz Interrupt value reached, counting up Interrupt value reached, counting down b--::l The interrupt is disabled when a "O" is entered; the interrupt is enabled when a"1" is entered. Counter 2 Counter 1 Byte O Offset 3 RESET status Offset 3 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 Byte O All interrupts are disabled. Example: Setting the IFR for counter 2 Basic address of the module: 136 L KH 3 } T PY 136 L KMOOO11OOO } T PY 139 Set register set 3 for access of the IFR for counter 2 Enable counter underflow interrupt and gate start interrupt 7 6 5 4 3 2 1 0 0 0 0 1 1 0 0 0 An interrupt is triggered for "counter underflow" and "gate start"; the other interrupts are suppressed. 1P 281 Equipment Manual @.SiemensA(31992, order No: 3 - 11 6ES5998-0KP21 R 11192 Software Settings 3.7 Interrupt Information Register (IIR) The interrupt information register is a 2-byte register in which the causes of an interrupt are entered. There is one common IIR for both counters. Allocation of the IIR 15 14 13 12 11 10 9 8 7 6 Disregard Disregard Gate stop Gate start Gate stop Gate start undefilo~ ~ Overflow Interrupt value reached, counting down Interrupt value reached, counting up \ Counter 2 I 5 4 3 2 1 0 ::::&75JJ Interrupt value reached, counting down Interrupt value reached, -- counting up / \ -- Counter 1 The cause of an interrupt is identified by a set bit. RESET status All bits: O Reading the IIR ~ The IIR must be read during interrupt processing. This read access resets the S5 interrupt and the IIR. The S5 can determine the cause of an interrupt by reading the IIR. The entire HR must always be read (2 bytes). Use of the word commands LPW/LOW is recommended for this purpose. Word commands cannot be used with CPU 944. Byte commands must be used for the access. During the access to the IIR with byte commands, the interrupt must be disabled with the S5 command 1A and enabled again after the access with the S5 command RA. New interrupts which occur while the IIR is being read are stored intermediately. These are entered in the IIR after the read access, and another interrupt is triggered. 3 - 12 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5!398-0KP21 Software Settings R 11/92 Example: Reading the IIR Prerequisites: - Memory for IIR value is DW 30 of DB 20. - Basic address of the module: 136 With word commands: L T C L T KH O PY 136 } DB 20 PW 136* DW 30 } Set register set O for the access to the IIR register Call data block 20 Store IIR in DW 30 With byte commands: L KH O T PY 136 } C DB 20 IA L PY 136* T DL 30 L PY 137' T DR 30 } RA Set register set O Call data block 20 Disable interrupts Store IIR in DW 30 Enable interrupts * Register address = basic address + offset 1P 281 Equipment Manual @ Siemens AG 1992, order No: 6E.% 998- (JKP21 3 - 13 R 11/92 So ffware Settings 3.8 Status Register There are three status registers containing information about the current status of the respective counter (status register 1 or 2) or the module (status register 3) (+ section 5.4). Each status register contains 1 byte and can only be read. The static entries are reset when the status register is read. Contents of Status Register 1 /2 7 6 5 4 3 2 1 0 S s s s d d d d I I I J- -L L s = Static entry, remains set until the register is read d = Dynamic entry, indicates the current status Gate ~tatu~ O: Gate closed (Counting pulses are not counted.) 1: Gate open (Counting pulses are counted.) p Counter runnlngl O: CRS = O 1: CRS = 1 Direction of counting o: up 1: Down DQ status O: Digital output is inactive (O V). 1: Digital output is active (24 V). L:cross'na O: No zero cr&+sing occurred 1: Zero crossing occurred O: Counter not loadad 1: Counter loaded Overflow O: No overflow 1: Overflow occurred Underflow O: No underflow 1: Underflow occurred 1 The CRS bit (last position of the respective counter) is entered in the status register. RESET Status 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 1 Offset 2 Status register 1 3 Status register 2 3 - 14 1P 281 Equipment Manual @ Siemens AG 1882, Order No: 6ES5998-OKP21 R 11192 Software Settinm Contents of Ststus Register 3 7 6 5 4 3 s s 2 1 0 s = Static entry, remains set until the register is read d = Dynamic entry, indicates the current status Illegel operating mode O: O~eratinq mode setting is correct. 1: Operatin~mode setting is incorrect. Counter 2 aubmodule Ineerted O: No 1: Yes Module parameterlzed O: No 1: Yes Wire break, counter 1 O: No 1: Yes Wire break, counter 2 O: No 1: Yes Disregard RESET Status 7 6 5 4 3 Iqq 2 1 0 o pl o Depending on whether a wire break has occurred 1 :Wire break O:NO wire break 1: Counter 2 submodule inserted O: Counter 2 submodule not inserted Offset 4 Status register 3 1P 281 Equipment Manual @.WmensA(31992, Order No: I 3 - 15 6ES!5998-0KP21 R 11/92 Software Settings 3.9 Parameter Registers and Control Registers The method of operation of the counters is set in the parameter registers and the control registers. Each counter is equipped with one parameter register (1 or 2) and one control register (1 or 2). Settings affecting both counters are made in global control register 3. ~ It is recommended thatthe 16-bit parameter registers rewritten with word commands (exception: PLC S5-115U, CPU 944A/B). Allocation of Parameter Registers 1/2 Except for bits 7 and 8, the allocation of parameter registers 1 and 2 is identical. See section 6 for the operating modes and functions. 15 14 13 12 11 10 9 .-- --. -- -- 8 7 6 5 4 3 2 1 0 ---- L L Counting mode 00: 1 (16 bits, positive) 01: 2 (32 bits, positive) 10: 3 (16 bits, positive/negative) 11: 4 (32 bits, positive/negative) Autonomous operating mode XXO: CONC 001: Ocss 011: OCHG 101: Ccss 111: CCHG Counting pulse evaluation 00: EVOT (one-time) 01: EVfT (two-time) 10: EVFT (four-time) 11: EVDI (direction) Combination operating mode Parameter reg. 2 Parameter reg. 1 00: No selection 01: TCAR 10: TCLR 11: ZMPC 00: No selection 01: SC2A 10: No selection 11 No selection Gate control, GFS O: By pulse 1: By level Inverting at counting input A O: Not inverted 1: Inverted Inverting at counting Input B O: Not inverted 1: Inverted Method of oDeratlon, dlaital outDut 000: DQNU 001: DQAO 010: DQAU 100: DQiU 101: DQID " ` - " Set counter (synchronization) O: Once 1: Several times 3 - 16 1P 281 Equipment Manual @ Siemens AG 1992, Order No:6ES5998-0KP21 R 11192 Software Settings Allocation of Control Registers 1 and 2 7 [ I 6 5 4 3 2 I I IL I 1 0 , J 1 1 I L ~ Gate start-stop (software gate from S5), GSS O: Gate is closing. 1: Gate is openingl. Gate enable, GEN O: Gate function is switched off. 1: Gate function is enabledl Gate stop per software, GST O: No effect 1: Stops the counterl Enable counting up synchronization, EUS O: Not enabied 1: Enabied2 ~ Enable countirw down synchronization, EDS ~'g'''''b'ed- - Load counter via software, LOS O: No effect 1: Counter is ioadedl. Not used 1 0 + 1 edge required 2 0 + 1 edge: synchronize once; 1 Ievei: muiti-synchronization Allocation of Control Register 3 I 1 I ~ Digitai output, counter 1, EDQ1 O: Switch off digitai output 1: Enabie digitai output Digitai output, counter 2, EDQ2 O: Switch off digitai output 1: Enabie digitai output k Moduie was completely parametrized O: No 1: Yes 3 Read counter synchronously, SYR O: Asynchronous reading 1: Synchronous reading ~ Controi counter mmchronousiu, SYC O : A s y n c h r o n o u s ~ontrol 1: Synchronous controi Not used 3 The parameterization bit with which you document the compiete parameterization of the moduie must be set during startup aftertheparameter register (or both registers) was/weretransferred tothe iP261. Toaccompiishthis, writecontroi register 3asthe iastwrite access. The parameterization bitistransferred bythe moduietostatus register3. Foraii additional entries in controi register3, the parameterization bit must be checked first (must be 1) in status register3, and the parameterization bit must then be set. iP 261 Equipment Manuai @ Siemens AG 1992, Order No: 6ES5 998-0KP21 3 - 17 R 11/92 Sothvare Settings 3.10 Overview of the Register Addresses S5 Command Register Length in Bytes Select register TPY/TOY 1 Control register 1 TPYITOY 1 Control register 2 TPYiTOY 1 Control register 3 TPYjTOY 1 Parameter register 1 Byte 1 Byte O TPW/TOW TPYITOY 2 w Parameter register 2 Byte 1 Byte O TPWITOW TPY/TOY 2 R IIR Byte 1 (counter 2) Byte O (counter 1) LPWILOW LPYILOY 2 Select Register Offset Address Read Write ~1 o OH 1 OH 2 OH 3 w w w w w OH 4 5 OH 6 7 OH 0 1 Selected Register OH 2 R Status register 1 LPW/LOY 1 OH 3 R Status register 2 LPYILOY 1 OH 4 R Status register 3 LPYILOY 1 IH 3 w w lH TPYITOY 1 Load register 1 Byte 3 Byte 2 Byte 1 Byte O TPWITOW TPY/TOY 2 or 4 depending on the mode of the counters R Counter value register 1 Byte 3 Byte 2 Byte 1 Byte O LPW/LOW LPY/LOY 2 or 4 depending on the mode of the counters R Counter value register 2 Byte 3 Byte 2 Byte 1 Byte O LPWILOW LPY/LOY 2 or 4 depending on the mode of the counters w Interrupt register 1 Byte 3 Byte 2 Byte 1 Byte O TPWITOW TPYITOY 2 or 4 depending on the mode of the counters w w IFR 2 TPYITOY 1 Load register 2 Byte 3 Byte 2 Byte 1 Byte O TPW/TOW TPYITOY 2 or 4 depending on the mode of the counters Interrupt register 2 Byte 3 Byte 2 Byte 1 Byte O TPWITOW TPYITOY 2 or 4 depending on the mode of the counters 4 5 6 7 IH 0 1 2 3 IH 4 5 6 7 2H 4 5 6 7 3H 3 3H 4 5 6 7 w 4H 4 5 6 7 IFR 1 1 XX = Any 3 - 18 IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 Interrupt Processing R 11192 4 Interrupt Processing , ., , , , 4.1 What Is Interrupt Processing? . . . . . . . . . . . . . . . . . ., .. ,.. . . . . . . . 4-1 4.2 Interrupt Processing . . . . . . . . . . . . . . . . . . . . . ,.. . .. .. .... .... .. 4-2 4.3 Reaction Times During Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4.4 Interrupt Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 6 4.5 Guidelines for Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 8 4.6 Hysteresis of the Interrupt Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 9 1P 281 Equipment Manual @ Siemens AG 1992. Order No: 6ES5998-OKP21 4-1 Interrupt Processing R 11/92 4 4.1 Interrupt Processing What Is Interrupt Processing? Interrupt processing takes place when a signal external to the processor (CPU, central processing unit of the PLC) interrupts the running program and triggers a separate program (the interrupt program). Interrupt processing is involved when such an interrupt signal is acquired via interrupt lines and fed to the central processing unit. Process interrupt processing is involved when acquisition is via input byte 160. Only interrupt processing can be triggered on the 1P 281. Process interrupt processing is not availabe on this module. The interrupt program acknowledges the queued interrupt and evaluates it by reading and storing current actual values, for example, or by generating an immediate reaction on a digital output module. After the interrupt program is processed, processing of the interrupted program is continued at the point at which it was interrupted. Interrupt processing is used to achieve fast reactions to changes in signal status. 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 4-1 R 11192 Interrupt Processing 4.2 Interrupt Processing This type of interrupt acquisition uses special interrupt lines on the S5 backplane bus to feed the interrupt signal to the central processing unit. Slot selection When selecting the slots, remember that interrupt lines are not available on all slots (+ section 8.5 and equipment manual of the PLC). Interrupt line selection One interrupt line on the module must be selected via DIL switch S2 to feed the interrupts from the [P 281 to the central processing unit. S2 IRD IRC IRB IRA ~ S5 interrupt lines IRA to IRD OFF: No interrupt ON: Interrupt via the applicable line The switch for the selected interrurX line must be set to ON: all other switches must beset to OFF. All fou; switches must beset to OF-F when the 1P 281 is operated without the triggering of interrupts. Several IP281 modules can reconnected to one interrupt line. The module which triggered the interrupt is determined in your interrupt program by reading the interrupt information registers on the modules. One organization block of the interrupt processing is assigned to each interrupt line. It is called when the corresponding interrupt line is activated. When several interrupts are queued, they are processed in the order of their priority (either set in data blockDXO(forS5-135U and S5- 155U) or starting with the organization block with the lowest number). 4-2 1P 281 Equipment Manual @ Siemens AG 19$)2, Order No: 6E&jgg8-r)Kp21 R 11/92 Interrupt Processing Interrupts are evaluated at different locations on different programmable controllers. Interrupt evaluation PLC I I I Interrupt pointa Occur At S5-115H I Synchronization points S5-115U Instruction boundaries S5-135U Block boundaries (standard setting) or instruction boundaries (can be set in data block DX O) I I I S5-155U (155u mode) I Instruction boundaries Remember the following when setting the interrupt points on the S5- 135L.L The advantage of fast acquisition after each instruction (in practical terms, reaction to an interrupt is immediate) must be weighed against the disadvantage that programming the interrupt-controlled program processing becomes much more complicated to ensure error-free "insertion" of the interrupt program after each STEP5 instruction. Among other things, this requires that certain instruction sequences for an interrupt be disabled by interrupts (either with software via STEP5 instruction or with special functions). Setting "interrupt at block boundaries" in data block DX O is always recommended when the reaction time permits. Particularly for interrupts after every instruction, remember that the signal states or values of temporary data must not be overwritten in the interrupt program. These values must be saved at the beginning of the interrupt- controlled program processing, and reloaded again at the end to ensure that they are again available unchanged to the running program. This particularly applies to the scratchpad flag area from flag byte FY 200 to FY 255. 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5998-0KP21 4-3 R 11192 Interrupt Processing 4.3 Reaction Times During Interrupt Processing The reaction time to an interrupt consists of the following partial times. - Acquisition time of the module - Acquisition time in the programmable controller - Processing time of the interrupt program Acquisition time of the module (An enabled interrupt source) The time between the triggering event and the triggering of the interrupt line is a maximum of2 ~sec. When the event is triggered by external signals, the delay time required to set the input filter must also be added(+ section 8.7). Acquisition time in the programmable controller Interrupt acquisition in the PLC depends on the programmable controller and the central processing unit used. Processing times of the system program can be found in the applicable equipment manuals. Interrupt at synchronization points The longest reaction time to an interrupt is usually the processing time between two synchronization points. Interrupt at instruction boundaries The longest reaction time to an interrupt is usually the processing time in the operating system or the processing time of special functions or integrated function blocks. Interrupt at block boundaries The longest reaction time of an interrupt is usually the processing time of the longest running part of the program without block calls or block end instructions. ~ Program loops injunction blocks often increase processing time significantly. Interrupt disable Always remember that no interrupts are processed during a programmed interrupt disable. The processing time of a program section containing an interrupt disable may have to be included when determining the reaction time to an interrupt. Processing time of the interrupt program The processing time is primarily determined by your own programming, 4 - 4 1P 281 Equipment Manual @ .Siemens AG 1992, order No: 6ES5888-0KP21 Interrupt Processing R 11192 When are interrupts acquired? Interrupts can be processed when the supply voltage of the module is within the tolerance range, and the RESET signal is inactive ("0"). Incoming interrupts are not processed as long as the BASP signal is active ("l"), When an interrupt is queued and the BASP signal becomes active, the interrupt is removed by the 1P 281 from the S5 bus. The interrupt is output again when the BASP signal becomes inactive again. This behavior is not affected by plug-in jumper X20 (BASP selection) (+ section 2.3). BASP 1 0 I I Startup or RESET: Interrupts are deleted. Interrupts are suppressed. Acknowledging the interrupts NT INT + $$$ Interrupt NW INT ? Interrupts cannot pass through. When an interrupt is triggered by an interrupt enabled in interrupt enable register IFR (-+ section 3.6), the cause is entered in interrupt information register HR. Interrupts which are not enabled do not trigger an interrupt and are not entered in the HR. Reading the IIR causes the interrupt to be reset, Although one byte in the HR is available to each counter (-+ section 3.7), the IIR must always be read in its entirety (2 bytes). For this reason, the use of word commands LPW/LOW is recommended for the access. When the CPU 944A/B is used, byte commands must be used for the access. While the IIR is being accessed with byte commands, the interrupt processing must b= disabled with the S5 command 1A, and then enabled again with RA after the access. When several interrupts occur before the IIR is read by the S5 CPU, these are also entered in the IIR. When interrupts arrive while the IIR is being read, these are stored intermediately. An interrupt is then triggered again after the read procedure is concluded. 1P 281 Equipment Manual @ Siemens AG 1992, Order No:6ES5998-0KP21 4-5 R 11/92 Interrupt Processing 4.4 Interrupt Sources The 1P 281 can trigger the interrupt processing on the S5 CPU when various events occur. There are 6 interrupt sources for each counter. These sources can be enabled bythe respective interrupt enable register. 7 6 0 0 5 4 3 2 1 0 1 r , , , , 0 = Interrupt disabled LL 11- 1 = Interrupt enabled Interrupt when interrupt value is reached while counting up Interrupt when interrupt value is reached while counting down Interrupt for overflow of the counter Interrupt for underflow of the counter Interrupt for gate start Several interrupt sources can be enabled for one counter. The triggering event (several if necessary) must be determined in the interrupt program by evaluating the interrupt information register (+ section 3.7), 1P 281 Equipment Manual 4 - 6 @ Siemens AG 1992, Order No: 6ES5998-OKP21 R 11/92 Interrud Processing Explanation of the Interrupts Interrupt when the interrupt value is reached while counting up The counter must be counting up. An interrupt is triggered when the counter value reaches the interrupt value. A hysteresis of & 1 is provided when the interrupt value is reached (+ section 4.6), Interrupt when the interrupt value is reached while counting down The counter must be counting down. An interrupt is triggered when the counter value reaches the interrupt value. A hysteresis of *1 is provided when the interrupt value is reached (+ section 4.6). Interrupt at counter overflow The interrupt is triggered when a counter overflow occurs. A hysteresis is provided when the overflow occurs (+ section 6.2.1). Interrupt at counter underflow The interrupt is triggered when a counter underflow occurs. A hysteresis is provided when the underflow occurs (+ section 6.2.1). Interrupt at gate start An interrupt is generated when the internal gate (-t section 6.6) is opened. When operating mode SC2A is used, the interrupt is also triggered when the interrupt value of counter 1 has not yet been reached (i.e., the interrupt is exclusively dependent on the hardware or software gate). Interrupt at gate stop An interrupt is generated when the internal gate (+ section 6.6) is closed. ~ Nointerruptisgenerated whenthegate isclosedviathe EMERGENCY GATEstop(GST in control register 1/2). 1P 281 Equipment Manual @SiemensA(31992, order No: 6Ef35998-0Kp21 4-7 Interrupt Processing 4.5 R 11192 Guidelines for Interrupt Processing The use of one or more counter modules with interrurX reauires some me~aration. .,wocessina-, ,, Use the following overview as an aid. . ,'h J: " ` ,, ,, , , .,1 II, %,'i ~n u, ,,, % ,!2!.-. ,I 1, 9 I , ~S ,#,, I 1, ,:< b ; I* b , ,n t > ,rJo , 1; . ) . . j~ .b ? Decide how many interrupt-generating modules you want to use, ~ Check todeterminewhere themodules can be installed (+ section 8.5 and the equipment manual of your PLC). D Q.:.j n "" "'cl ~.. `? Selectthe interrupt linewith DILswitch S2 (+section 4.2). ~,,: :?ti :. a I L T JU A A Fw 100 R' % ~ l G b 5.1 . The table in section 4.2 shows you where an interrupt will interrupt youruser program: at block boundaries or at instruction boundaries or at synchronization points. 10" ""'0'0" '01 ~ Allocate theinterruptenable register described infection 4.4 based on your application. 1 1 0 0 0 0 1 1 0s3 OB2 ~ Setup yourinterrupt program inthe applicable interrupt OBs. . ~ 4-8 1P 281 Equipment Manual @ .Siemens AG 1992, C)rrjer No: 6ES5998-0KP21 Interrupt Processing R 11/92 4.6 Hysteresis of the Interrupt Value Each counter is equipped with an interrupt register in which an interrupt can be stored. Acceptance of the interrupt value can be triggered by the S5 (+ section 3.4) or by operating mode TCAR (-t section 6.4.2). The interrupt value is always compared with the current counter value (hardware comparator). The following can occur when the counting value reaches the interrupt value. - An interrupt is triggered (-+ section 4.4). - The digital output is activated (+ section 6.7). - Counter 2 is started (+ section 6.4.5, SC2A). Hysteresis for interrupt processing When the encoder stops at the interrupt-triggering position, the encoder can oscillate back and forth around this interrupt point. Interrupts would be triggered continuously or the digital output activated. To prevent this undesired triggering of interrupts, the interrupt values are provided with a hysteresis of Al. The counter cannot trigger a new interrupt unless it reaches a value at least 2 greater or 2 less than the interrupt value. Example: 3FFD 3FFE 3FFF Hysteresis -1 4000 4001 4002 4003 1 t Interrupt value = 4000 - An interrupt is triggered when the value 4000 is reached. - If the counter oscillates between 3FFFand 4001, no further interrupts are triggered even if the counter repeatedly reaches the value 4000. - Anew interrupt is triggered when the counter reaches the value3FFE (or less) or the value 4002 (or greater) and then assumes the value 4000 again. The hysteresis is reset by loading the counter or the interrupt register. 1P 281 Equipment Manual @ .%ITKXIS AG 1992, Order No:6ES5998-0KP21 4-9 Commissioning the Counter Modu/e R 11192 5 Commissioning the Counter Module 5.1 Commissioning Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 1 5.2 Startup Behavior of the Counter Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 3 5.3 5.3.1 5.3.2 RESET Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 RESETCauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Basic Setting ofthelP281 after RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 5.4 Evaluation ofthe Status Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5 5.5 Changing the DirectionofCounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8 5.6 Overviewofthe Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 IP281 EquipmentManual @SiemensAG 1992, OrderNo: 6ES5998-0KP21 5-1 R1l/92 Commissioning the Counter Module 5 5.1 Commissioning the Counter Module Commissioning Guidelines Hardware settings (items 1 to 5) and software settings (items 6 to 9) must be performed during the commissioning of the counter module. WI ? m I@l ? I@l. m I@l 1' Check the following after unpacking the module. Release status of the module (Labelling on the front plate) Release status of the plug- in submodule 3, Adjust the module to the application conditions. Interface selection 24 V encoder interface -Change interface selection plug -in jumper? -Change reference potential plug-in jumper? -Change limit frequency plug-in jumper? -Circuit Din RE? ) -Change wire break recognition plug-in Section 2.3 jumper? RS 422 interface - Change interface selection plug -in jumper? -Change reference potential plug-in jumper? -Change wire break recognition plug-in jumper? Limit frequency of the digital inputs 1 Minimum r.mlse duration of the diaital outrmts F `nterrupt ~ m 4, errupt processing is used, use DIL switch S2 int select the interrupt line for your module. Section 2.2 when to 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 5-1 R 11192 Commissioning the Counter Modu/e ?. 6. Setup the registers and write your startup program in 06s 20 to 22 of your programmable controller. Parameterization DB I ~ 7. Now setup your cyclic program in 061. ? R-J ma Don'tforgetto include the status registers in your startup program. These registers supply you with information concerning the module or the individual counters. ~ Don'tforgetto include the status registers in your program. These registers supply you with information concerning the module or the individual counters. I OB 2 L Section 3.2 to section 3.9 ? OB 1 I 5. Switch off the programmable controller and insert the module in the slot provided. (Only certain slots are provided for interrupt processing via interrupt lines.) ~ 8. If necessary, setup yourinterrupt program inthe applicable interrupt organization block. I ON ? ) 9. When switching on the programmable controller, proceed in the seauence as recommended below. Opera~ing mode switch on the central processing unit to STOP Switch on power voltage for the programmable controller. (Perform an "overall reset" for the program memory if switching on for the first time.) 3. Transfer blocks from the programmer to the programmable controller. 4. Start the central processing unit with a "new start". " It is expressly pointed out that incorrect handling or operating or incorrect connection can damage the 1P 281 module. This can also cause extensive damage to your system. We make the assumption that only qualified personnel who are also familiar with the ESD protection regulations will work with the module. 5-2 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-OKP21 R 11/92 5.2 Commissioning the Counter Modu/e Startup of the Counter Module After switching on the supply voltage and an inactive RESET of the S5, the module is readv. for operation and-the green `%U-N" LED goes on. I Indication RUN LED o 0 Meaning ERR LED Voltage supply missing (from S5) RESET is active. Module is operating correctly. Parameterization error or wire break 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 5-3 R 11/92 Commissioning the Counter Module 5.3 RESET Behavior 5.3.1 RESET Causes There are two conditions which can cause a RESET of the 1P 281. - RESET due to the S5 RES~ signal - RESET due to power failure or power too low (hardware RESET) The module is reset as soon as one of the two causes occurs. After the reset, the module has the same status as it did after the first startup. 5.3.2 Basic Setting of the 1P 281 after RESET (i.e., they are 6-bit counters Counting mode Counter 1 and counter 2 operate in mode and count from O to FFFFH). Counter status The counters have the value "O". Operating mode The "continuous counting" (CONC) operating mode is set for both counters. Gate The gate function is switched off (i.e., the counter counts (regardless of the signals on the STA and STO input). Counting pulse evaluation One-time evaluation (EVOT) is set for both counters. Interrupts All interrupts are disabled (IFR = O). Registers The registers are deleted (= O). The status registers contain the current status. Digital outputs The DQNU method of operating is set. The digital outputs are inhibited. 1P 281 Equipment Manual 5-4 @ Siemens AG 1992, order No: 6ES5 998-0KP21 Commissioning the Counter Module R 11/92 Evaluation of the Status Registers 5.4 Status registers 1 to 3 contain information on the current status of the counters and the module. There are static entries and dynamic entries. Static: Dynamic: The applicable bit is set when the triggering event occurs. Reading the status register causes the static bits to be reset. The current status is indicated. Contents of Status Register 1/2 s = Static d = Dynamic Gate atatus O: Gate closed (Counting pulses are not counted.) 1: Gate open (Counting pulses are counted.) Counter running O: CRS = O 1: CRS = 1 Direction of counting o: up 1: Down DQ atatus (DQS) O: Digital output is inactive (O V). 1: Digital output is active (24 V). zero crossing O: No zero crossing occurred. 1: Zero crossing occurred. Set (SPE) O: Counter not loaded 1: Counter loaded Overflow (OVF) O: No overflow 1: Overflow occurred Underflow (UNF) O: No underflow 1: Underflow occurred Status after RESET 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 1 IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 5-5 R 11/92 Commissioning the Counter Module Gate status Indicates the current status of the internal gate (-t section 6.6) Counter running The CRS (counter, bit O) of the applicable counter is entered in the status register. Counting direction This bit indicates the current direction of counting. When stopped, the direction of counting last indicated is retained. DQ status This bit indicates whether the digital output is active (24 V level on DQ). Zero crossing This bit is set when the counter reaches the value O during counting. Reading the register causes the bit to be reset. Set This bit is set each time the counter is loaded. Reading the register causes the bit to be reset. Overflow This bit is set when the counter exceeds the upper counting range limit (+ section 6,2.1). Reading the register causes the bit to be reset. Underflow This bit is set when the counter passes below the lower counting range limit (-+ section 6.2.1). Reading the register causes the bit to be reset. 5 - 6 1P 281 Equipment Manual @.SiemensA(31992, C)rder No:6E85998-0KP21 R 11/92 Commissioning the Counter Module Contents of Status Register 3 7 6 5 4 3 2 1 0 s s d d I s = Static d d = Dynamic I ~ Illegal operating mode (IOM) O: Operating mode setting is legal. 1: Operating mode setting is incorrect. L Counter 2 submodule inserted O: No 1: Yes Module psrsmeterized O: No 1: Yes Wire bresk, counter 1 " O: No 1: Yes ~ Wire bresk, counter 2 O: No 1: Yes Disregard Status after RESET 7 6 5 x x x 4 3 @ ~ 2 1 0 o @ o ~Wirebreak m e s s a g e i s q u e u e d : 1 Wire break message is not queued: O @ C o u n t e r 2submoduleis p r e s e n t : 1 Counter 2 submodule is not present: O Illegal operating mode (IOM) Monitors the parameterization. The bit is automatically set to O when the parameterization is legal. The parameterization must be checked if the bit is set (+ section 6.4). Counter 2 sub- module inserted This bit indicates whether the plug- in submodule is installed. Module parameterized After the 1P 281 has been parameterized, the S5 can use control register3 (set bit 2) to report that the module is parameterized. Assoonasthe bit has been set (during startup) in the control register, it can be read back via the status register for monitoring purposes. This status bit remains set as long as operation of the module is "normal". It is deleted when a supply voltage failure occurs or the S5 initiates a RESET (i.e., the parameterization is lost). Wire break, counters 1/2 As soon as a wire break occurs on the RS 422 encoder interface (+ section 1.4.1 .2), the applicable bit is set in status register 3 if the wire break recognition is active. Reading the status register causes the bitto be reset if no more errors are queued. Statuss Bit 4/5 ~ Status bit is not reset. 1P 281 Equipment Manual @ .%31WIS AG 1992, Order No: 6ES5 998-0KP21 5-7 R 11192 Commissioning the Counter Modu/e 5.5 Changing the Direction of Counting The direction of counting is determined by two different methods depending on the type of pulse evaluation. When encoders with two pulse trains displaced by 90" (counting pulse evaluation EVO~ Em, EVFT) are used, the direction of counting is derived from the signal sequences of A and B (+ section 6,2,2). By inverting the input signals while retaining the same direction of rotation of the encoder, the direction of counting can be changed without having to change the wiring. The inversion is set in the parameter register of the respective counter. Parameter Register 1/2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ~ Inversion at counting input A O: Not inverted 1: Inverted ~ Inversion at counting input B O: Not inverted 1: Inverted When encoders with one pulse train (counting pulse evaluation EVDI) are used, the direction of counting is specified by the level at counting input B or by bit 11. Inversion is specified at counting input B (+ section 6.2.2). 5 - 8 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 Commissioning the Counter Module R 11192 5.6 Overview of the Operating Modes r 3perating Mode --- Counting Mode Operating Mode Gate Control Counter 1 I Counter 2 Counter 1 I Counter 2 Counters 1 and 2 Hardware Gate 1 H= CONC Wtonomous )perating node combination )perating nodes Ocssl Ccss 1 2 3 4 ++++ OCHG/ CCHG 1 2 3 4 + + + + 1 2 3 4 +---+-- -- -+- --- -+ +++ +++ + + +++ - + + + + - + + -++ 1 2 3 4 +---+-- --+- -- -- -+ +++ +++ -++ -++ 1 2 3 4 +++i++++ ++++ ++++ ++++ ++++ ++++ ++++ TCLR ZMPC SC2A 1 2 3 4 start Stopl + + + + + 1 2 3 41 ++++ TCAR stop 1 1 2 3 4 I Software Gate Start i-+--Fi++++ ++++ + + + + + + + + + + + + + + + + + + + + The autonomous operating modes can be combined aa desired. + + + + +++ +++ +++ +++ +++ +++ +++ 2 -++ -++ -++ -++ -++ -++ -++ + + + Setting permitted - Setting not permitted: The ERR LED goes on and the IOM bit 3 is set in status register 3. . Setting has no effect: The module does not operate in this mode. The ERR LED does not 90 on and the IOM bit is not set in =tatus register 3. + No practical use 1 The software EMERGENCY OFF gate stop is always possible except with counter 2 for ZMPC. 2 When operating mode ZMPC is used, gate control for counter 2 has no effect. When operating mode ZMPC is used, counter 2 must operate with counting pulse evaluation EVDI, and counter 1 with EVOT, EVTT or EVFT. The counting pulse evaluation can be selected as desired for all other operating modes. IP 281 Equipment Manual @ .W17WIS AG 1992, Order No: 8ES5 998-0KP21 5-9 Operating Modes and Functions R 11/92 6 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.2 6.2.1 6.2.2 CounterSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Counting Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Counting Pulse Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 Autonomous Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 ContinuousCounting (CONC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 One-Time Counting with Software Start (OCSS) . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9 One-Time Counting with Hardware Gate Start (OCHG) . . . . . . . . . . . . . . . . . . . . 6-11 Cyclic Counting with Software Start (CCSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13 Cyclic Counting with HardwareGate Start (CCHG) . . . . . . . . . . . . . . . . . . . . . . . . 6-15 6.4 6.4.1 6.4.2 6.4.3 6.4.4 6.4.5 Combination Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17 TransferringtheCountingValue tothelnterruptRegister(TCAR) . . . . . . . . . . . . 6-18 TransferringtheCountingValue tothe Load Register(TCLR) . . . . . . . . . . . . . . . 6-19 ConnectingtheZeroMarking Pulse to Counter2(ZMPC) . . . . . . . . . . . . . . . . . . 6-20 Starting Counter 2Whenthelnterrupt Value ofCounterl lsReached (SC2A) . 6-21 6.5 6.5.1 6.5.1.1 6.5.1.2 6.5.1.3 6.5.2 6.5.3 Handling theCounters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23 Loading the Counters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23 Loading bytheS5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23 Loading with theZero Pulseand S~lnput (Synchronization) . . . . . . . . . . . . . . 6-24 External ResetofaCounter* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27 Controlling Both Counters Synchronously . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-28 Reading theCounters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29 6.6 6.6.1 6.6.2 6.6.3 6.6.4 6.6.5 GateControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-30 Activatingthe GateControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 Hardware Gate Control with Pulses (GAPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 HardwareGateControlwith Level (GALE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32 Software GateControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-33 EMERGENCYOFFGate Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-33 6.7 6.7.1 6.7.2 6.7.3 Method ofOperation of the Digital Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-34 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-34 Digital Output Switched Off(DQNU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-35 Digital OutputActive inthe Range Between the lnterruptValue and Underflow (DQAU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 6-36 Digital OutputActiveinthe Range Between thelnterruptValue andOverflow (DQAO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-37 Pulse on the Digital OutputWhen the lnterruptValue lsReached While Counting Up(DQIU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-38 Pulse on the Digital OutputWhen the lnterruptValue lsReached While Counting Down(DQID) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39 6.7.4 6.7.5 6.7.6 6.8 Block Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-40 * Under development lP281 EquipmentManual @SiemensAG 1992, OrderNo: 6ES5998-0KP21 6-I R 11/92 O~eratina Modes and Functions Operating Modes and Functions 6 ,. . . ........ . , . . . ... .:... ... .. ... ..v.....:<...:..:.:.s..5.. .5..5.. ..5. ..5.. .5..<..5..<. ..<.5...<. 5..<..5. ..5.. 5.. .,.:.5..:..5.<.$.:.<.: .<.5<. .<. .s. .s.5.<.: .. . . ..x.,,.. . . ....... ..... :... . . :i:;..:1.: 1.,.:.,..:.:..:..:..:..:. :.. :..,:...: ..: .:..:..:..:..:.:..:..:..:..,.:..:..:.,:..,:..,:.,.:..,:...: .:..:..:..:..:..:.:.:.,.: .: :. :.:.,:.,.:,.....:,: :,:,:., :.,: : : ;:..: .:.:..: :.i.:i:..:.:.. :.;.:. :...,:..:.:..,.: .:..,..,. .., .,.. .,.. .,.. :..,. ..,. ..,.:..,. .., . ..: ., .. ,. ..:..,.:.'.:.:..,.:.:.:.:.-:.:.<%n,A12E. ....... 6.1 Introduction The 1P 281 munter module offers great flexibility in adapting its functions to the requirements of many different counting applications. Counter settings must be performed specifying the counting mode and the type of counting pulse acquisition (+ section 6.2). The autonomous operating mode allows the method of operation of each individual counter to be set (+ section 6.3). The combination operating modes which couple the functions of both counters are particularly useful for certain applications (-t section 6.4). The counters can be loaded with defined values. Both counters can be controlled synchronously. The counter values can be read out individually or simultaneously (+ section 6.5). The counters are equipped with a gate control which allows both hardware control by the digital inputs and software control by the S5 (+ section 6.6). Various methods of operation (i.e., the conditions under which the digital output activates) can be set for the digital output of each counter (+ section 6.7). 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 6-1 Operating Modes and Functions 6.2 Counter Settings 6.2.1 Counting Mode R 11/92 The counting mode specifies the counting width and range for each counter separately. The basic setting for both counters after power-on is counting mode 1. The counting mode for munter 1 is set in parameter register 1; the counting mode for counter 2 is set in parameter register 2. All counting modes are permitted for the autonomous operating modes and the combination operating modes ZMPC and SC2A. The combination operating modes TCAR and TCLR require that both counters operate in the same counting mode. Counting mode 1 The counter has a counting width of 16 bits and operates in the positive counting range listed below. 0000 o to to FFFF +65,535 (hexadecimal) (decimal) Parameter register 1/2 15 Counting mode 2 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 The counter has a counting width of 32 bits and operates in the positive counting range listed below. [hexadecimal) 00000000 to FFFF FFFF to4,294 ,967,295 (decimal) " o Parameter register 1/2 15 14 13 12 11 10 9 Counting mode 3 8 7 6 5 4 3 2 1 0 0 1 The counter has a counting width of 16 bits and operates in the positive and negative counting range listed below. 8000 -32,768 to 7FFF to +32,767 (hexadecimal) (decimal) Parameter register 1/2 15 14 13 12 11 10 9 6-2 8 7 6 5 4 3 2 1 0 1 0 1P 281 Equipment Menuel @ .%WWMS AG 1992, Order No: 6ES5 996-0KP21 R 11/92 Operating Modes and Functions Counting mode 4 The counter has a counting width of 32 bits and operates in the positive and negative counting range listed below. (hexadecimal) (decimal) to 7FFF FFFF to +2,147,483,647 80000000 -2,1 47,483,648 Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 ~ The counters use binary operation in all counting modes and can count up and down in the ranges set. The counting width also sets the width of the load, interrupt and counter value registers. Overflow/underflow An overflow occurs when the upper counting range limit is exceeded while counting up. Underflow occurs when the lower counting range limit is exceeded while counting down. -1 +1 Counting Mode Hysteresis Upper Counting Range Limit Lower Counting Range Limit 1: FFFE FFFF 0000 cool 2: FFFF FFFE FFFF FFFF 00000000 00000001 3: 7FFE 7FFF 8000 Sool 4: 7FFF FFFE 7FFF FFFF 8000 OOW 80000001 When an encoder is "stationary", oscillation of this encoder around the actual value can change the counter status. When the counter stops on a range limit, this could cause overflow/underflow to be triggered continuously. To avoid this, overflow and underflow are provided with a fixed hysteresis of 1 (i.e., to trigger a new overflow/underflow, the value of the "upper counting range limit+ 1"/''lower counting range limit -1" must be reached respectively, When oscillation around the counting range limits occurs, one overflow and one underflow are triggered and the hysteresis then becomes active. The hysteresis is reset when the counter or the interrupt register is loaded. 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 888-0KP21 6-3 R 11192 Operating Modes and Functions 6.2.2 Counting Pulse Evaluation The counters can operate with one-time, two-time or four-time pulse evaluation, or with direction evaluation. The type of counting pulse evaluation is set for each counter individually in the parameter register. One-time evaluation (EVOT) Upward counting pulses are generated with arising edge of A and low level on B. Downward counting pulses are generated with afalling edge of A and low level on B. Input A I Input B 1 Upward counting pulsea u 1 u Parameter register 1/2 EVOT Two-time evaluation (lNTT') A counting pulse is generated for every rising and falling edge of A. The direction of "counting depends on the level at input B. Input A Input B Upward counting pulses u u u Downward counting pulses I-Ill Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 0 1 4 3 2 1 0 Evl-r 6-4 1P 281 Equipment Manual @ sit?t_IR?nS AG 1992, Order No: 6ES5 9s16-0KP21 Operating Modes and Functions R 11/92 Four-time evaluation (EVFT) A counting pulse is generated for every rising and falling edge of A and B. The direction of counting depends on the level at inputs A and B. Input A [ 1 Input B I Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 1 0 4 3 2 1 0 EvFr Direction evaluation (EVDI) When counting with one counting input, the acquisition of counting pulses occurs at munting input A. The positive edge causes a change in the counting value (one-time evaluation). Counting input B is used to evaluate the direction of counting. Low level at input B: High level at input B: A Counting up Counting down ! Caution The counting value can become invalid if the encoder is oscillating around its actual value. I I Input A I Input B up I I 1 I I L I OOwn Upward ;:::"' ~ :=%rd pulses ~ Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 1 1 4 3 2 1 0 EVDI 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 6-5 R 11/92 Operating Modes and Functions When the 24 V encoder interface is used, the direction of counting can be specified via the "inversion at counting input B" bit in parameter register 1 /2, without using input B*, Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 1 1 T Inversion at counting input B O: Counter is counting up. 1: Counter is counting down. Inversion of the input signals 4 3 2 1 0 EVDI Input signals A and B can be inverted. The setting is made in the respective parameter register as shown below. Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Inversion at counting input A O: No inversion 1: Inversion ~ Inversion at counting input B O: No inversion 1: Inversion When incremental encoders with two pulse trains displaced by ~ 90" are used, the direction of counting can be changed by the inversion of one counting input, without having to rewire the counting inputs. A ! Caution If the setting (inversion/no inversion) is changed while the counter is running, the level change can cause an extra counting pulse to be generated. To avoid this error, the counter must be loaded after parametrization (with the value O if necessary). 6 - 6 IP 281 Equipment Manual @ SiemenS AG 1892, Order No: 6ES5 986-0KP21 Operating Modes and Functions R 11192 6.3 Autonomous Operating Modes 6.3.1 Overview The method of operation of a counter is specified by setting the autonomous operating mode. There are five autonomous operating modes. Continuous counting, CONC -- One-time counting with soflware gate start, OCSS -- One-time counting with hardware gate start, OCHG Cyclic counting with software gate start, CCSS -- Cyclic munting with hardware gate start, CCHG The autonomous operating modes can be combined as desired when the 1P 281 is operated with two counters. All counter settings (counting mode and counting pulse evaluation) can be selected as desired with the autonomous operating modes. Available Gate Controls Gate Control Operating Mode Hardware Gate Software Gate CONC Yea No* Ocss Ccss No Yes No Yes OCHG Yes No* CCHG Yes No* * The EMERGENCY OFF gate atop is always available (+ section 6.6.5). ~ Hardware and software gate control do nottake effect until enabled in control register 1/2 (GEN bit). The following are permitted with all autonomous operating modes. - All load capabilities (+ section 6.5.1) -All read capabilities (+ section 6.5.3) - All methods of operation of the digital outputs (+ section 6.7) - All interrupt lines (+ section 4.4) Behavior during overflow and underflow is described in section 6.2.1. 1P 281 Equipment Manual @ %3WIS AG 1992, Order No: 6ES5 998-0KP21 6 - 7 R 11/92 Operating Modes and Functions 6.3.2 Continuous Counting (CONC) Method of operation The counter starts to count at the current counting value and counts continuously. After RES= the current counting value is O. / //- up -.. `;=WI'J Example: Counting mode 1 \ Gate control _- ------------ --___ - - - - Down -------- -- - - -- - - - FFFF `] / //' Hardware gate via pulse (+ section 6.6.2) Hardware gate via level (+ section 6.6.3) - The gate function is disabled after RESET (i.e., the counter counts). - Gate control does not take effect until the gate function (GEN bit) is enabled in control register 1/2. Gate start: - PuLse at digital input STA - High level at digital input STA Gate stop: - Pulse at digital input STO - Low level at digital input STA ~ Thecounter can beloadedwith avaluebythe S5beforetheoperating mode is set. The counter then begins counting starting with this value (+ section 6.5.1.1). Parameter register 1/2 The operating mode and the type of gate control are set in parameter re- gister 1 /2. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 x x o 1 0 T GFS = O: Hardware gate puke GFS = 1: Hardware gate level Control register 1/2 CONC x = Any The gate function is enabled/disabled with the control register using the GEN bit. An EMERGENCY OFF gate stop is available via the GST bit. 7 6 5 4 3 2 1 T T 0 GEN = O: Disable gate function GEN = 1: Enable gate function GST = 1: Close gate 6-8 IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 996-0KP21 Operating Modes and Functions R 11/92 6.3.3 One-Time Counting with Software Start (OCSS) Method of operation When the software gate opens, the counter is loaded with the value stored in the load register, and begins to count starting with this value. It is stopped by the following. - Overflow of the counter - Underflow of the counter - The software gate closes. The counter remains in stop status until the software gate is opened again. Underflow Overflow -+ +Example: Counting mode 1 t Oooo 1I I I Load value FFFF When a range limit is exceeded, the counter stops at this limit (e.g., in counting mode 1, the counter stops at OOOOH when an underflow occurs and at FFFFH when an overflow occurs). Gate control Software gate control with GSS bit O in control register 1/2 Start: stop: GSS bit O: 1 GSS bit O: O ~ Thegate function must be enabled incontroi register 1/2. Evaluation of bit 6 (overflow) and bit 7 (underflow) in status register 1/2 is used to determine whether the counter has exceeded a range limit. Notes This operating mode cannot be set unless the gate function has been enabled by the GEN bit (bit 1 in control register 1/2). Otherwise the message "illegal operating mode" is output (IOM in status register 3) and the ERROR LED goes on, The settings must be performed in the sequence listed below. 1. Enable gate function (GEN in control register 1/2) 2. Set operating mode (parameter register 1/2) 1P 281 Equipment Manual @ siefTIenS AG 1992, Order No: 6ES5 888-0KP21 6 - 9 R 11/92 Operating Modes and Functions Control register 1/2 Control register 1/2 is used for the following purposes. - Disable/enable the gate function with the GEN bit - Software gate control with the GSS bit - EMERGENCY OFF gate stop with the GST bit 7 6 5 4 3 2 1 0 I TTT GSS = O +1: Open gate GSS = O: Close gate GEN = O: Disable gate function GEN = 1: Enable gate function GST = 1: Close gate Parameter register 112 The OCSS operating mode is set in parameter register 1/2. 15 14 13 12 11 10 9 6 7 6 5 4 3 2 0 0 1 1 0 Ocss 6 - 10 1P 281 Equipment Manual @ SieI_I_IenS AG 1992, Order No: 6ES5 996-0KP21 R 11/92 6.3.4 Operating Modes and Functions One-Time Counting with Hardware Gate Start (OCHG) Method of operation The counter operates as an up/down munter. When the hardware gate opens, the counter is loaded with the value stored in the load register, and begins to count starting with this value. It is stopped by the following. - Overflow of the counter - Underflow of the counter - Closure of the hardware gate The counter remains in stop status until the hardware gate is opened again. Underflow Example: Countina mode 1 Overflow `-~-+ , I 0000 1 I I Load value FFFF When a range limit is exceeded, the counter stops at this limit (e.g., in counting mode 1, the counter stops at OOOOH when an underflow occurs and at FFFFH when an overflow occurs). Gate control Hardware aate via mdse (+ section 6.6.2) Hardware Gate via ievel (~ section 6.6.3)' Start: - Pulse at digital input STA - High level at digital input STA stop: - Pulse at digital input STO - Low level at digital input STA ~ Thegate function must be enabled inthe control register. Notes Evaluation of bit 6 (overflow) and bit 7 (underflow) in status register 1/2 is used to determine whether the counter has exceeded a range limit. This operating mode cannot be set unless the gate function has been enabled by the GEN bit (bit 1 in control register 1/2). Otherwise the message "illegal operating mode" is output (IOM in status register 3) and the ERROR LED goes on. The settings must be performed in the sequence listed below. 1, Enable gate function (GEN in control register 1/2) 2. Set operating mode (parameter register 1/2) 1P 281 Equipment Manual @ %3YHIS AG 1992, Order No: 6ES5 998-0KP21 6 - 11 Operating Modes and Functions Control register 1/2 R 11/92 The control register is used to enable/disable the gate function with the GEN bit. An EMERGENCY OFF gate stop is available with the GST bit. 7 6 5 4 3 2 1 0 1---1GEN = O: Disable gate function GEN = 1: Enable gate function 1 GST = 1: Close gate Parameter register 1/2 The operating mode and the type of gate control are set in parameter register 1/2. 15 14 13 12 11 10 9 T 8 7 6 GFS = O: Hardware gate pulse GFS = 1: Hardware gate level 6 - 12 5 4 3 2 1 1 1 0 + OCHG [P 281 Equipment Manual @ Si9m9nS AG 1992, Order No: 6ES5 996-0KP21 R 11/92 6.3.5 Operating Modes and Functions Cyclic Counting with Software Starl (CCSS) Method of operation When the software gate opens, the counter is loaded with the load value, and begins to count starting with this value. If a counting range limit is exceeded (overflow or underflow), the counter is loaded again with the load value, and resumes counting starting with this value. The counter is stopped when the software gate closes. Underflow Overflow Example: coun'ingmode' "~-" Load valua FFFF Oooo The counter behaves as shown below when the load value corresponds to a range limit. Example: counting mode 1, 16 bits, positive counting range E Gate control I Direction of Counting Load Value up I I Down 0000 (hunter counts "continuously". 0000 to FFFF+OOOO tO FFFF-+ Counter stops at OrIOOH. FFFF Counter stops at FFFFH. Counter counts `continuously". FFFF to OOOO+FFFF to 0000+ Software gate Start: stop: GSS bit O in control register 1/2: 1 GSS bit O in control register 1/2: O ~ Thegate function must have been enabled in control register 1/2. Notes This operating mode cannot be set unless the gate function has been enabled by the GEN bit (bit 1 in control register 1/2). Otherwise the IOM message ("illegal operating mode") is output and the ERROR LED goes on. The settings must thus be performed in the sequence listed below. 1. Enable gate function (GEN in control register 1/2) 2. Set operating mode (parameter register 1/2) 1P 281 Equipment Manual @ SieI_IIenS AG 1992, Order No: 6ES5 996-0KP21 6 - 13 R 11192 Operating Modes and Functions Control register 1/2 Control register 1/2 is used for the following purposes. - Disable/enable the gate function with the GEN bit - Software gate control with the GSS bit - EMERGENCY OFF gate stop with the GST bit MHIYfl -r-r-r I G& = O +1: Open gate Close gate GSS = O: GEN = O: Disable gate function GEN = 1: Enable gate function GST = 1: Close gate Parameter register 1/2 The operating mode is set in parameter register 1/2. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 Ccss 6 - 14 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 R1l/92 6.3.6 Operating Modes and Functions Cyclic Counting with Hardware Gate Start (CCHG) Method of operation When the hardware gate opens, the counter is loaded with the load value, and begins to count starting with this value. If a counting range limit is exceeded (overflow or underflow), the counter is loaded again with the load value, and resumes counting starting with this value. The counter is stopped when the hardware gate closes. Example: Counting Underflow Overflow , - . - - - - - - - - - - - - - - . ~-- - - - - - - - -- , 1 { v mode 1 ` - 0000 Load value FFFF The counter behaves as shown below when the load value corresponds to a range limit. Example: counting mode 1, 16 bits, positive counting range Direction of Counting Load Value Gate control up Down 0000 Counter counts "continuously". 0000 to FFFF+OOOO to FFFF+ Counter stops at OOOOHi FFFF (hunter stops at FFFFH. Counter counts "continuously". FFFF to OOOO+FFFF to 0000+ Hardware gate via pulse (+ section 6,6.2) Hardware gate via level (+ section 6.6.3) Start: - Pulse at digital input STA - High level at digital input STA stop: - Pulse at digital input STO - Low level at digital input STA ~ Thegatefunction must be enabled in control register 1/2. Notes This operating mode cannot be set unless the gate function has been enabled by the GEN bit (bit 1 in control register 1/2). Otherwise the IOM message is output ("illegal operating mode in status register 3") and the ERROR LED goes on. The settings must thus be performed in the sequence listed below. 1. Enable gate function (GEN in control register 1/2) 2. Set operating mode (parameter register 1/2) IP 281 Equipment Manual @ SieI?IenS AG 1992, Order No: 6ES5 998-0KP21 6 - 15 R 11192 Operating Modes and Functions Control register 1/2 The control register is used for the following purposes. - Disable/enable the gate function the the GEN bit - EMERGENCY OFF gate stop with the GST bit 7 6 5 4 3 2 1 0 TT I GEN = O: Disable gate function GEN = 1: Enable gate function GST= 1: Close gate Parameter register 1/2 The operating mode and the type of gate control are set in parameter register 1/2. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 T 1 0 CCHG GFS = O: Hardware gate pulse GFS = 1: Hardware gate level 6 - 16 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 996-0KP21 R 11/92 Operating Modes and Functions 6.4 Combination Operating Modes 6.4.1 Overview Both munters are required for the combination operating modes. The ERROR LED goes on and the IOM bit is set in status register 3 when the plug-in submodule is not installed. The combination operating modes couple the functions of the counters. In addition to the combination operating mode, the counting mode, the counting pulse evaluation and the autonomous operating mode must beset for both counters. The permissible settings are shown below. Combination Operating Mode Counter 1 TCLR ZMPC SC2A Counter 1 Counter 2 g$g ggg o~o c) o %~ (n o 0 06 o~o Q o G U)g c) 0: Counter 2 1 TCAR Autonomous Operating Mode Counting Mode 2 3 4 1 +--- *++ - + + 2 +++ - + + +++ - + + +++ - + + 3 -- +-- -- +- 4 -- -- 1 +--- -- +-- + - - + + 2 +++ - + + 3 ---- -- + + i +- ------ + +++ - + + 4 +++ - + + 1 + + + + - + + 2 ++++ + + + - + + 3 ++++ + + + - + + 4 - + + * * + + + + + + 1 + + + + + + + - + + 2 + + + + + + + - + + 3 + + + + + + + - + + 4 ++++ +++ - + + Gate Control Hardware Gate Software Gate Yes Yea Yes Yes Yesl yesl Yes Yes + Setting permitkd - Setting not permitted: The ERROR LED goes on and the IOM bit is set in status register3. Setting has no effect: The module does not operate in this setting. The ERROR LED doea not go on and the IOM bit is not se~ in status register 3. + No practical use 1 In ZMPC operating mode, gate control is only available for counter 1. Gate control for counter 2 has no effect. When operating mode ZMPC is used, counter 2 must operate with counting pulse evaluation EVDI and counter 1 with EVOT, EVTTor EVFT The counting pulse evaluation can be selected as desired for all other operating modes. 1P 281 Equipment Manual @ SiemenS AG 1992, Order No: 6ES5 998-0KP21 6 - 17 R 11/92 ODeratina Modes and Functions 6.4.2 Transferring the Counting Value to the Interrupt Register (TCAR) Method of operation The counting value of counter 1 is entered in the interrupt register of counter 2 when internal gate 1 closes (+ section 6.6). Gate control The gate functions available are specified by setting the autonomous operating mode (+ section 6.3) for the individual counters. ~ An EMERGENCYOFF gatestop (control registerl) doesnot cause the interrupt value to be transferred. Load counter All load capabilities described in section 6.5.1 and allowed by the autonomous operating mode (+ section 6.3) are permitted. Read counter All read capabilities are permitted (+ section 6.5.3). Digital output All methods of operation are permitted (+ section 6.7). Interrupt All interrupt settings are permitted (+ section 4.4). Special notes Both counters must operate in the same counting mode. The IOM bit is set ERROR LED goes on when two different count- in status register 3 and the . . . Ing modes are Selected. When operating mode TCAR is used, interrupt register 2 (counter 2) cannot be written by the S5. The interrupt value transferred to counter 2 can be determined by reading counter value register 1 after the internal gate of counter 1 has closed (bit O in status register 1 = O). Parameter register Operating mode TCAR is set in parameter register 2. Parameter register 2 15 14 13 12 11 10 9 8 7 0 1 6 5 4 3 2 1 0 T TCAR 6 - 18 1P 261 Equipment Msnual @ sk?M(?fIS AG 1992, Order No: 6ES5 996-0KP21 R11192 6.4.3 Operating Modes and Functions Transferring the Counting Value to the Load Register (TCLR) Method of operation The value of counter 1 is entered in the load register of counter 2 when internal gate 1 closes (+ section 6.6). Gate control The gate functions available are specified by setting the autonomous operating mode (+ section 6.3) for the individual counters. ~ An EMERGENCY OFFgate stop (control register 1) does not cause the load value to be transferred. Load counter All load capabilities allowed by the autonomous operating mode set are permitted. Read counter All read capabilities are permitted (+ section 6.5.3). Digital output All methods of operation are permitted (+ section 6.7). Interrupt All interrupt settings are permitted (+ section 4.4). Special notes Both counters must operate in the same counting mode. The IOM bit is set in status register 3 and the ERROR LED goes on when two different counting modes are selected. When operating mode TCLR is used, load register 2 of counter 2 cannot be written by the S5. The load value transferred to counter 2 is determined by reading counter value register 1 after the internal gate of counter 1 has closed (bit O in status register 1 = O). Parameter register Operating mode TCLR is set in parameter register 2. Parameter register 2 15 14 13 12 fll 10 9 8 7 1 0 6 5 4 3 2 1 0 T TCLR 1P 281 Equipment Msnusl @ skXI'IWIS AG 1992, Order No: 6ES5 888-0KP21 6 - 19 Operating Modes and Functions 6.4.4 R 11/92 Connecting the Zero Marking Pulse to Counter 2 (ZMPC) Method of operation The zero marking pulse of encoder 1 is the counting signal for counter 2 (zero marking pulse counter). The direction of counting for counter 2 is derived from counting signals A and B of counter 1. Gate control Counter 1: - Gate functions specified by the autonomous operating mode set - All gate functions described in section 6.6 Counter 2: No gate functions available. The zero marking pulses are always transferred to counter 2 (even when the gate of counter 1 is closed). Counter 1: All load capabilities are permitted (+ section 6.5.1). Counter 2: Only practical via the LOS bit in control register 2 Load counter Read counter All read capabilities are permitted (+ section 6.5.3). Digital output All methods of operation are permitted (+ section 6,7), Interrupt Counter 1: All interrupt settings are permitted (+ section 4.4). Counter 2: The gate start and gate stop interrupts cannot be used since counter 2 does not operate with gate functions. Special notes The zero marking pulse counter (counter 2) evaluates the rising edge of the zero marking pulse when counting up, and the falling edge when counting down. Parameter register The ZMPC operating mode is set in parameter register 2. The load value should be "O". Parameter register 2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 -+ ` + ` + ` ` r ZMPC EVDI1 CCSS2 10 = C o u n t i n g mode 32 or 11 = Counting mode 42 1 Failure to make these settings will cause the IOM message to occur in status register 3 and the ERROR LED to go on. 2 Recommended setting Underflow . - -- Example for counter 2: Overlbw `:~:' :::gngmodea ~ - Loed v a l u e O moo 6 - 20 Loed value 7FFF 1P 281 Equipment Manual @ sieI_fIenS AG 1992, Order No: 6ES5 9W-0KP21 R11192 6.4.5 Operating Modes and Functions Starting Counter2 When the Interrupt Value of Counter 1 Is Reached (SC2A) Method of operation Counter 2 is started when both of the conditions below are met. - Counter 1 reaches the interrupt value. - The gate of counter 2 (gate 2) is open. When counter 1 reaches the interrupt value, the gate function appropriate to the autonomous operating mode set takes effect for counter 2. Closing of gate 2 (also EMERGENCY OFF gate stop) stops counter 2 and blocks gate function 2. The gate function does not take effect again for counter 2 until interrupt value 1 is reached again. Example Counter 1 reaches interrupt value. .- Herdwere gate 2 or software gate 2 Internal gate 2 Counter 2 Gate control Load counter Counter 1: - Gate functions specified by the autonomous operating mode set - All gate functions described in section 6.6 Counter 2: - Same as counter 1 except that the gate function must be enabled by reaching the interrupt value of counter 1 Counter 1: All load capabilities described in section 6.5.1 are permitted. Counter 2: Only practical via LOS bit in control register 2 Read counter All read capabilities are permitted (+ section 6.5.3). Digital output All methods of operation are permitted (+ section 6.7). Interrupt All interrupt settings are permitted (+ section 4.4). Special notes The interrupt value of counter 1 is provided with a hysteresis of~l (+ section 4.6). The interrupt at the gate start is also triggered when the interrupt value of counter 1 is not yet reached (i.e., the interrupt is exclusively dependent on the hardware or software gate). 1P 281 Equipment Manuel @ siWIV3nS AG 1992, Order No: 6ES5 998-0KP21 6 - 21 R 11/92 Operating Modes and Functions Control register 2 Control register 2 7 6 5 4 3 2 1 0 GEN = O: Gate function disabled GEN = 1: Gate function enabled Parameter register The SC2A operating mode is set in parameter register 1. Parameter register 1 15 14 13 12 11 10 9 8 7 0 1 6 5 4 3 2 1 0 T SC2A 6 - 22 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 996-0KP21 Operating Modes and Functions R 11/92 6.5 Handling the Counters 6.5.1 Loading the Counters The 1P 281 offers several ways to load the counters with a value stored in the load register. - Loading by the S5 - Loading by zero pulse and SET input (synchronization) - Loading by operating mode-related loading procedures 6.5.1.1 Loading by the S5 Method of operation The counter can be loaded with the load value by the S5 by using the O + 1 edge of the LOS control bit in control register 1/2. = Loading can bepedormed whilethe counter is running. Control registerl/2 7 6 5 43210 LOS = O: No effect LOS = 1: Load counter Confirmation of loading The SPE bit is set in the applicable status register 1/2 during when the counter is loaded. The status bit is reset when the status register is read out. Status register 1/2 7 6 5 4 3 2 1 0 SPE = 1: Counter was loaded. SPE = O: Counter was not loaded. 1P 281 Equipment Manual @ SiemenS AG 1992, Order No: 6ES5 998-0KP21 6 - 23 R 11/92 Operating Modes and Functions 6.5.1.2 Loading with the Zero Pulse and SET Input (Synchronization) The respective counter is loaded with the value stored in the load register when the zero pulse occurs. The synchronization can be performed either at the 1st zero pulse or at every zero pulse. Method of operation Synchronization can be performed either while counting up or counting down. Upward counting synchronization is performed at the rising edge of the zero pulse under the following conditions. - Enabling has been performed by the EUS control bit. - The external S13 signal is on high level. - The counter is counting up. Downward counting synchronization is performed at the failing - edge of the zero pulse u;de; the following conditions. - Enabling has been performed by the EDS control bit. - The external S13 signal is on high level. - The counter is counting down. One-time, counting upward, synchronization A I B SET UP/DOWN EUS 1 1P - N I t Counter is loaded. ( L t Counter is not loaded. One-time, counting downward, synchronization UP/DOWN J - Counter is loaded. 6 - 24 Counter is not loaded. 1P 281 Equipment Manual @ .%3'IW?S AG 1992, Order No: 6ES5 996-0KP21 R 11/92 Operating Modes and Functions Multiple, counting upward, synchronization UP/DOWNl `p EUS J Ckmnter is loaded. Counter & loaded. Multiple, counting downward, synchronization UP/DOWN J b"'" f=Ds ~ N~ t t bunter is loaded. Parameter register Counter is loaded. The selection of one-time or multiple synchronization is made in parameter register 1/2 for the respective counter. Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 O: One-time synchronization 1: Multiple synchronization 1P 281 Equipment Manual @ .%YfNYW AG 1992, Order No: 6ES5 988-0KP21 6 - 25 R 11/92 Operating Modes and Functions Control register The EUS bit must be set in control register 1 /2 for upwardmunting synchronization and the EDS bit for downward counting synchronization. Control register 1/2 7 6 5 4 3 2 1 0 One-time: The applicable bit must beset (O --+1 edge required) before the zero pulse occurs. The applicable bit must beset during the entire synchroniza- Multiple: tion time period. SET input Synchronization requires that the external S= signal be on high level during synrchonization. The SET signal must occur before the synchronization event. Confirmation of synchronization After synchronization has been performed, the SPE status bit (counter loaded) is set in status register 1/2 of the respective counter. This bit is reset when the status register k read. Status register 1/2 7 6 5 4 3 2 1 0 SPE I: Counter was loaded. SPE O: Counter was not loaded A ! Caution 6 - 26 The digital output must be switched off (EDQ bit in control register 3) during synchronization. This prevents the counter from activating the interrupt function and thus the digital output during synchronization (loading). 1P 281 Equipment Manual @ sif3Mf3nS AG 1992, Order No: 6ES5 996-0KP21 O~eratina Modes and Functions R 11192 6.5.1.3 External Reset of a Counter* * Under development 1P 281 Equipment Manual @ siWTKJIM AG 1992, Order No: 6ES5 888-0KP21 6 - 27 R 11192 Operating Modes and Functions 6.5.2 Controlling Both Counters Synchronously Method of operation The 1P 281 offers the capability of using the software gate to start and stop both counters per software simultaneously. Both software gates are controlled by control register 1. Requirements Synchronous mntrol of the counters requires that the two conditions listed below be met. - Operating mode OCSS or CCSS (any combination) must be set. - The SYC bit must be set in control register 3. Control register 3 7 6 5 4 3 2 1 0 SYC = O:NO synchronous control SYC = l: Synchronous control of both counters Start/stop of the counter Setting the GSS bit in control register 1 causes the software gates to be opened for both counters simultaneously. When the GSS bit is reset, the gates are also closed. Control register 1 7 6 5 4 3 2 1 0 GSS = 1: Gates will be opened. GSS = O: Gates will be closed. The GSS bit in control register 2 has no function during synchronous control. The GEN 2 and GST 2 bits retain their function. 6 - 28 1P 281 Equipment Manual @ siOfWnS AG 1892, Order No: 6ES5 996-0KP21 R 11/92 6.5.3 Operating Modes and Functions Raeding the Counters Counter 1 is read by reading counter value register 1 (CVR 1) and counter 2 by reading CVR 2 (+section 3.5). The counters can be read both separately (asynchronously) and simultaneously (synchronously). The basic setting is asynchronous. Reading counters asynchronously The counters are read separately. The counter value in the respective counter value register is retained during the first read access while the read-out takes place. The SYR synchronous bit in control register 3 must be "O" when the asyn- chronous read access takes place. Control register 3 7 6 5 4 3 2 1 0 SYR = O Reading counters 1 and 2 synchronously Setting the SYR bit in control register 3 causes the counter values in both counter value registers to be retained simultaneously. Both counter value registers can then be read. The contents of CVR 1 and 2 are retained until theSYR bit is set to "O" again. The following sequence must be adhered to for a synchronous read access. 1. Set SYR bit to "1", 2. Read first counter value register. 3. Read second counter value register. 4. Reset SYR bit to "O". ~ If the SYR bit is not reset, thesame value will be read again during the next read access. Control register 3 7 6 5 4 3 2 1 0 SYR =0: Current counter value SYR =1: 8oth counter values frozen BottI counter values frozen SYR J 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 888-0KP21 Current cmunter values 6 - 29 R 11192 Operating Modes and Functions Gate Control 6.6 The counters are equipped with a gate control offering the following capabilities. - Hardware gate control by level - Hardware gate control by pulse - Software gate control The gate mntrol is activated in control register 1/2 for the respective counter. The internal gate can be closed with an EMERGENCY OFF gate stop for all types of gate control. Priorities of the gate control The following diagram shows the priorities of the gate control. hcraasing priority + u GAPU GALE I DI STA + GST Hardware gate / DI STO ~ + A SaIaction of operating node `-i Gate status Intern. gate v EMER~ GENCY OFF gate atop ::a- P SC2A GEN I I ~ 4 ~ Counting pulse enable for counter m status register 1 1-d Gate control onloff e' for operating mode SC2A Interrupt The status of the gate is indicated in status register 1 for counter 1 and status register 2 for counter 2. 7 6 5 4 3 2 1 0 T 1: Gate open O: Gate closed 6 - 30 1P 281 Equipment Manual @ siWTN?fW AG 1992, Order No: 6ES5 996-0KP21 R 11/92 Operating Modes and Functions Activating the Gate Control 6.6.1 After the startup of the module, the gate control is switched off (i.e., the gate is open and the counting pulses are fotwarded to the counter). The gate control is switched on/off in control register 1 for counter 1 and in control register 2 for for counter 2. Control register 1/2 7 6 5 4 3 2 1 0 GEN = O: Gate function switched off GEN = 1: Gate function switched on 6.6.2 Hardware Gate Control with Pukes (GAPU) Method of operation The gate is controlled by pulses on the STA and STO digital inputs. - Pulse on the STA input - Pulse on the STO input Gate start: Gate stop: Dll STA D12 STO Parameter register The GAPU hardware gate control is parameterized in parameter register 1 for counter 1 and in parameter register 2 for counter 2. Parameter register 1/2 15 14 13 12 11 10 9 + GAPU 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 8 7 6 5 4 3 2 1 0 I XXO: CONC 011: OCHG 111: CCHG 6 - 31 R 11/92 Operating Modes and Functions 6.6.3 Hardware Gate Control with Level (GALE) Method of operation The gate control is performed via level on the STA digital input. - High level on the STA digital input - Low level on the STA digital input Gate start: Gate stop: The STO digital input must be applied to 0. DI STA :~ DI STO Internal gate Parameter register ;;: ~ The GALE gate control is parameterized in parameter register 1 for coun- ter 1 and in parameter register 2 for counter 2. Parameter register 1/2 15 14 13 12 11 10 9 + GALE 6 - 32 8 7 6 5 4 3 2 1 0 I )0(0: CONC 011: OCHG 1 1 1 : CCHG 1P 281 Equipment Manual @ sit3mEMIS AG 1992, C)rder No: 6ES5 996-0KP21 R 11/92 6.6.4 Operating Modes and Functions Software Gate Control Software gate control must be used when there are no hardware signals from the external system to start and stop the counters, or when this information must first be obtained from the user program in the S5. Method of operation The software gate control is performed with the GSS bit in control re- gister 1 /2. - Setting the GSS bit - Resetting the GSS bit Gate start: Gate stop: Parameter register Software gate control can only be used with operating modes OCSS and CCSS. The software gate is activated by parameterizing one of these operating modes in parameter register 1/2. Parameter register 1/2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 001 : Ocss 101 : Control register Ccss Control register 1/2 7 6 5 4 3 2 1 0 T GSS = O: Gate will be opened. GSS = 1: Gate will be closed. 6.6.5 EMERGENCY OFF Gate Stop Method of operation The hardware gate and software gate of the respective counter are closed by setting the GST bit in control register 1/2. The EMERGENCY OFF gate stop can be used with all operating modes (except counter 2 in operating mode ZMPC) regardless of the type of gate control. ~ In operating modes TCLRand TCAR, the EMERGENCYOFF gate stop does not cause the load or interrupt value to be transferred. The EMERGENCY OFF gate stop also does not affect the digital outputs. Control register 1/2 7 6 5 4 3 2 1 0 TGST = 1: Gate will be closed. GST = O: No effect 1P 281 Equipment Manual @ %3'?'WIS AG 1992, Order No: 6ES5 ee8-oKP21 6 - 33 R 11/92 Operating Modes and Functions 6.7 Method of Operation of the Digital Outputs 6.7.1 Overview Each counter is equipped with a digital output which can be used to directly trigger processes external to the 1P 281 (+ section 1.4.3). The method of o~eration (i.e., the conditions under which it is activated) of this diaital outtwt can be set separately for eachmunter in parameter register 1/2. Five possibilities are-available. - Digital output switched off, DQNU - Digital output active in the range between the interrupt value and underflow, DQAU - Digital output active in the range between the interrupt value and overflow, DQAO - Pulse on the digital output when the interrupt value is reached while counting upward, DQIU - Pulse on the digital output when the interrupt value is reached while counting downward, DQID Enabling the digital outputs The respective digital output is enabled by setting the EDQ 1/2 bit. The digital output is switched off (no delay!) by resetting this bit. Caution The digital output becomes externally active again when the conditions for an active digital output are met (e.g., minimum pulse still exists), and the digital output is enabled withEDQ). `Qontema') ~ EDQ J DQ(efiema,) ~ Control register 3 ~ EDQ1 (counter 1) EDQ2 (counter 2) 6 - 34 @ .%31TNMS 1P 281 Equipment Manual AG 1992, Order No: 6ES5 988-0KP21 R 11/92 Operating Modes and Functions Basic setting After the startup of the module, both digital outputs are switched off. This means that the following conditions exist. - DQNU is selected. - Bit EDQ1 and bit EDQ2 in control register 3 are "0". Status indication The status of a digital output (external digital output) is evaluated via the DQS bit in status register 1 or 2. Status register 1/2 m DQS =0: Digital output inactive DQS =1: Digital output active 6.7.2 Digital Output Switched Off (DQNU) Method of operation This setting switches the digital output off. This may be necessary to prevent accidental switching (e.g., during synchronization). When this function is used, the digital output is switched to low level. ~ When DQNLJ is transferred while the digital output is active, the output remains active until the end of the minimum pulse. If the output is to be disabled immediately, this can be done with control bits EDQ1 and EDQ2 in control register 3. Parameter register 1/2 15 14 0 13 0 12 11 10 9 8 7 6 5 4 3 2 1 0 0 DQNU 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 6 - 35 R 11/92 O~eratina Modes and Functions 6.7.3 Digital Output Active in the Range Between the Interrupt Value and Underflow (DQAU) Method of operation I I Underflow Interrupt vslue Overflow The digital output is switched active when the counting value is in the range from interrupt value to underflow. The output remains active at Ieastforthe duration of the pulse set with a plug-in jumper (+ section 1.4.3 and section 2.3). Parameter register 1/2 15 14 13 12 o 1 0 11 10 9 8 7 6 5 4 3 2 1 0 DQAU Control register 3 The respective digital output must be enabled with the EDQ bit in control register 3. Control register 3 7 6 5 4 3 2 1 0 --F-Q O = Digitsl outpul switched off 1 = Digitsl output ensbled Hysteresis The following hysteresises take effect on the limits of the active range. Interrupt value: Oveflow/underflow: 6 - 36 Hysteresis for interrupt value (+ section 4.6) Overflow/underflow hysteresis (-t section 6.2.1 ) 1P 281 Equipment Msnuel @ SieIIIenS AG 1992, Order No: 6ES5 966-0KP21 R 11/92 6.7.4 Operating Modes and Functions Digital Output Active in the Range Between the Interrupt Value and Overflow (DQAO) Method of operation 1 I Underflow I Interrupt value Overflow The digital output is switched active when the counting value is in the range from interrupt value to overflow. The output remains active at least for the duration of the pulse set with a plug-in jumper (+ section 2.3). Parameter register 1/2 15 14 13 12 0 0 1 11 10 9 8 7 6 5 4 3 2 1 0 DQAO Control register 3 The respective digital output must be enabled with the EDQ bit in control register 3. Control register 3 O = Digital output switched off 1 = Digital output enabled Hysteresis The following hysteresises take effect on the limits of the active range. Interrupt value: Oveflow/underflow: 1P 281 Equipment Manual @SiemensA(31992, C)rder No:6ES5998-0KP21 Hysteresis for interrupt value (+ section 4.6) Overflow/underflow hysteresis (+ section 6.2.1) 6 - 37 R 11192 Operatina Modes and Functions 6.7.5 Pulse on the Digital Output When the Interrupt Value Is Reached While Counting Up (DQIU) Method of operation When the counting value reaches the interrupt value while counting up, the digital output is activated for a minimum pulse duration which can be set (10 msec, 100 msec, 500 msec + section 2.3). The interrupt value is provided with a hysteresis of +1 (+ section 4.6). A pulse is not triggered when the counting value reaches the interrupt value again while the digital output is still active (the time between the triggering events is less than the minimum puLse duration set). Another pulse cannot be triggered until the digital output is no longer active. Parameter register 15 14 13 12 0 0 11 10 9 8 7 6 5 4 3 2 1 0 + DQIU Control register 3 The respective digital output must be enabled with the EDQ bit in control register 3. Control register 3 O = Digital output switched off 1 = Digital output enabled 6 - 38 1P 281 Equipment Manual @ siEM7W3flS AG 1992, Order No: 6ES5 996-0KP21 ODeratina Modes and Functions R 11192 6.7.6 Pulse on the Digital Output When the Interrupt Value Is Reached While Counting Down (DQID) Method of operation When the counting value reaches the interrupt value while counting down, the digital output is activated for a minimum pulse duration (10 msec, 100 msec, 500 msec -+ section 2.3), The interrupt value is provided with a hysteresis of+l (+ section 4.6). A pulse is not triggered when the counting value reaches the interrupt value again while the digital output is still active (the time between the triggering events is less than the minimum pulse duration set). Another pulse cannot be triggered until the digital output is no longer active. Parameter register 15 14 13 12 0 1 11 10 9 8 7 6 5 4 3 2 1 0 + DQID Control register 3 The respective digital output must be enabled with the EDQ bit in control reqister 3. Control register 3 O = Digital output switched off 1 = Digital output enabled 1P 261 Equipment Manual @ siWTW31W AG 1992, Order No: 6ES5 998-0KP21 6 - 39 Operating Modes and Functions 6.8 R 11/92 Block Circuit Diagram 3........ -.-.2 5 J-- ; -- L Figure 6.1: 6 - 40 Block circuit diagnm of the 1P 281 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 996-0KP21 Programming Example R 11/92 7 Programming Example 7.1 General . . . . . . . . . . . ............................................... 7-1 7.2 Startup . . . . . . . . . . . ............................................... 7-4 7.3 Cyclic Program ,, , . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 7.4 InterruptProcessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 - 6 7.5 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 - 7 7-1 lP281Equipment Msnual @SiemensAG 1992.0rderNo:6ES5 998-0KP21 Programming Example R11192 7.1 General Use As an introduction working with the 1P 281, this section contains a programming example which can be run on PLC S5-1 15U/S5- 115H. (OB 20 and DX O must be added to the program when PLC S5-135U or S5-155U/S5-l 55H is used.) You can use this program as the basis for your own program. The individual blocks must then be adapted or supplemented to suit the application. Block allocation Block Function OB 1 Cyclic program processing OB 2 Interrupt-controlled program proc8asing for IRA OB 21 Startup bahaviorfor manual power-on (STOP -> RUN) OB 22 Startup behavior for return of voltage FB 10 Interfaces for inputa/outputs FB 20 Startup FB for 1P 281 FB 21 Cyclic main program FB 22 Interrupt program DB 20 Working DB for IP 281 1 IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 888-0KP21 7-1 R 11/92 Programming Example Device configuration - One of the programmable controllers listed (+section 1.2) - Programmer (e,g, PG 685, PG 750) - 1P 281 counter module - Encoder with two pulse trainsl displaced by 90 - Digital input module (e.g.,6ES5420-4UA11) - Digital output module (e.g. 6ES5 421 -4UA11) - Simulator for digital inputs and outputs (e.g.,6ES5788-0LA12) PLC 1 I n--------- rrug[tull[lw I I WI] t IJ / Innml Iu ~ u I 1 1 , 1 1 1, I 1 1 1 1 . . . . . . . . . . . . . . . . . . . [, I 1 1 1 4 I nl I I II - Simulator 1 The enmder must provide signals in the upward direction or no DQ activation and no inter- rupt will occur. An input signal must be inverted if the direction of rotation is wrong. 7-2 1P 281 Equipment Manual @ siWfWIM AG 1992, Order No: 6ES5 998-0KP21 R 11192 Hardware settings Programming Example Set basic address 128 and select interrupt line IRA on the 1P 281 counter module (+ section 2.2). When a 5.2 V encoder in accordance with RS 422 is used, the interface selection and the reference potential must also be changed (+ section 2.3). Parameterization The module operates in ZMPC combination mode (zero marking pulse counter). Counters 1 and 2 are parameterized as shown below (+ section 3). Counter 1 - Gate enable, GEN = 1 - Counting mode 3 - Counting pulse evaluation EVFT - Autonomous operating mode CCSS - Counting inputs not inverted - Digital output enabled - Method of operation of the digital output, DQAO - Interrupt at overflow enabled - Load value: -30000 - Interrupt value: -5000 Counter 2 - Gate enable, GEN = 1 - Counting mode 3 - Counting pulse evaluation EVDI - Autonomous operating mode CCSS - Counting inputs not inverted - Digital output enabled - Method of operation of the digital output, DQAU - No interrupt enabled - Load value: O - Interrupt value: 50 Method of operation of the counters in the program example Counter 1 is loaded with load value -30000. When interrupt value -5000 is reached, the digital output is activated (active until overflow). An interrupt is triggered at overflow. Counter 2 counts the zero marking pulse crossings. It is loaded with the load value O if it reaches the value 100. The digital output is active from the load value to the interrupt value. The counting procedure is continually repeated. 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 7-3 R 11/92 Programming Example 7.2 Startup The module must be parameterized during startup, The module is not equipped with a buffer. Since the parameterization is lost when a power failure occurs or the module is switched off, the parameterization data must be transferred to the 1P 281 each time a new start or restart is performed. OB 21 OB 21 is processed during a manual new start (PG selection and operating mode switch STOP+ RUN). It calls startup block FB 20 and working (parametrization) data block DB 20. OB 22 OB 22 is processed when a restart is performed due to return of voltage (power-on). It is identical to OB 21. FB 20 The following is performed in the startup FB. - The register addresses (basic address +0 to basic address +7) are calculated and stored in DB 20 to simplify addressing in the cyclic program. - The parameter register and control register aretransferred from DB20to the 1P 281. - The parameterization bit is set. Keep the following in mind. - Control register 3 must be transferred after parameterization (set parametrization bit). - When setting the autonomous operating modes (except CONC), the GEN bit must first be set in control register 1/2 for the gate enable, and then the parameter register. Otherwise the ERROR LED goes on. - When CPU 944A/B is used, the correct addressing sequence must be adhered to. DB 20 DB 20 is used as parameterization DB and working DB. The addresses (128 +0 to 128 +7) calculated during startup are entered in DW O to DW 7. In addition, the register contents are stored for the startup in DB 20 (DW 8 to DW 12), All other register accesses (read and write accesses) are also performed via this DB (DW 13 to DW 30). DW31 isthestorage Iocation forsavingthe register set address during read and write accesses. The interrupt program accesses this location to update the register set selection again after an interrupt is processed. 7-4 1P 281 Equipment Manual @ Siemens AG 1992, orijer No: 6ES5 9gs-0Kp21 R 11/92 7.3 Programming Example Cyclic Program Function blocks FB 21 and FB 10, and working data block DB 20 are called by OB 1 in the cyclic program. FB 21 contains the main cyclic program for the 1P 281. FB 21 The structure of the segments makes it easy to handle the individual program parts (e.g., when setting up your program). During cyclic operation, the programmed functions are selected one after another. The individual functions (load, read write, etc.) can be made dependent (software links and digital input signals) on certain events. Keep the following in mind when programming. - When the counter value registers are read, the interrupts must be disabled with 1A before the register set is called, and enabled again with RA after the read access. - The selected register set must be saved for all other (not interrupt-disabled) accesses. R must be stored in DW 31 after selection. - If control register3 is to be transferred, a check in status register3 must be made before to determine whether the parameterization bit is still set to"1" (parameterization exists), The parameterization bit must then be setto 1 with the OW instruction. If the parameterization bit in status register 3 is set to "O", a new start or restart must be performed to restore the parameterization. DB 20 All accesses (read and write) are performed via working data block DB 20. FB 10 FB 10 provides the allocation to the inputs and outputs. It is only required when a simulator is used. 1P 281 Equipment Msnusl @ siemenS AG 1992, Order No: 6ES5 998-0KP21 7-5 Programming Example 7.4 R 11/92 Interrupt Processing OB 2 is called when an interrupt is triggered via IRA. OB 2 calls funotion block FB 22 and working data block DB 20. FB 22 The interrupt information register is read in the interrupt program, and at the end of interrupt processing, the register set present before the interrupt arrived is restored again, (The register set address is stored in DW 31 of DB 20.) The interrupts must be disabled with 1A while the IIR is being read, and then enabled again with RA. 7-6 1P 281 Equipment Manual @ %31TN311S AG 1882, Order No: 6ES5 996-0KP21 R 11192 7.5 Programming Example Program OB 1 B: PROBEIST.S5D 0000 SEGMENT 1 Oooo :JU FB 21 0002 NAME :CYCLIC DB 20 0 0 0 4 DBNR : 0006 :JU FB 10 0008 OOOA NAME :1/Q Oooc :BE OOOE CYCLIC PROGRAM Call FB with cyclic program Working data block Interface to inputs/outputs B: STS5D OB 2 SEGMENT 1 Oooo 0001 NAME 0 0 0 2 DBNR 0003 :JU FB :INTERUPT DB : :BE 0000 22 Call FB with interrupt program Working data block B: PROBEISTS5D 0000 :JU FB 20 :START-UP KF +128 DB 20 ! :BE Call startup FB Basic address Working data block 0000 :JU FB 20 :START-UP +128 KF : DB 20 : :BE LEN=1O Call startup FB Basic address Working data block FB 10 B: PROBEISTS5D LEN=25 INTERFACE TO INPUT/OUTPUTS SEGMENT 1 NAME : l/Q OOOA Oooc OOOE 0010 0012 0014 0016 0018 oOIA Oolc OOIE 0020 0022 0024 LEN=1O B: PROBEISTS5D OB 22 SEGMENT 1 Oooo 0001 NAME ADR 0002 0 0 0 3 DBNR 0004 LEN=9 INTERRUPT OB FOR IRA 20 OB 21 SEGMENT 1 Oooo 0001 NAME 0002 ADR 0 0 0 3 DBNR 0004 LEN=13 :C DB 20 % DR QB :4 25 9 :: : :L IB :T DR IB :L :T DR :L IB DR :T :BE 4 8 5 9 6 10 :L :T :L :T :L :T Working data block Status register 1 Status register 2 Status register 3 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 Control register 1 Control register 2 Control register 3 7 - 7 Programming Example R 11192 FB 20 B: PROBEISTS5D SEGMENT 1 NAME :START-UP Decl :ADR Dad :DBNR OOOB Oooc OOOE OOOF 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 OOIA O(I1B OOID OOIE O(XF 0020 0022 0023 0024 0025 0026 0027 0028 0029 002/4 O02B O02C O02D o(32E o02F Oo30 0031 0033 0034 0035 0036 0037 (XX38 Oo3A O03B O(I3D O03E O03F 0040 0041 0043 0044 0045 0046 0047 7-8 Oooo LEN=77 STARTUP FB FOR 1P 281 I/Q/D/B/T/C: D KM/KH/lCY/KS/KF/KT/KC/KG: l/Q/D/Bn/C: B :DO =DBNR KH 0000 :L :T FW20 =ADR :LW :T FW22 MOO1 :L FW 22 :DO FW 20 :T DW O :L FW 20 :1 1 :T FW 20 :L FW 22 :1 :T FW h :TAK :L KF +7 :<=F =MOO1 :JC KF Open working DB Calculate addreasas and store in working DB :L :DO :T KH DW PY 0000 O O Select register set O Basic address (byte +0) ;L :DO :T DR DW PY 8 1 O Write control register 1 Address byte +1 :L :DO :T DR DW PY 9 2 O Write control register 2 Address byte +2 :L :DO :T :L :DO :T DL DW PY DR DW PY 11 4 O 11 5 O Write parameter register 1 Address byte +4 :L :DO :T :L :DO :T % PY DR DW PY 42 O 12 7 O :L :DO :T KH DW PY 0000 O O :L DW 10 :L KM 0000000000000100 :Ow :DO DW 3 :T PY O Address byte +5 Write parameter register 2 Address byte +6 Address byte +7 Select register set O Basic address (byte +0) Set "parametrization" bit in control register 3 Write control register 2 Address byte +3 IP 281 Equipment Manual @ sif3Mt3nS AG 1992, Order No: 6ES5 998-0KP21 Rll192 Programming Example FB 21 B: PROBEIST.S5D SEGMENT 1 Name :CYCLIC Dad :DBNR 0008 SEGMENT2 0009 OOOA OCOB OOOD OOOE oOOF 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 OOIA 001 B Oolc OOID 001 E 001 F 0020 0021 0022 0023 0024 0025 0026 0027 W328 W29 O02A SEGMENT 3 O02B O02D O02E O02F 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 O03A SEGMENT4 O03B O03D O03E O03F 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 Oow LEN=208 Sheet 1 MAIN CYCLIC PROGRAM OF THE 1P 281 IIQIDIBITIC: B .*** 0008 =DBNR READ COUNTER VALUE REGISTER :DO :IA :L :DO :T KH 0001 DW O PYo :DO :L :T :DO :L :T :DO :L :T :DO :L :T DW O PYo DL 27 DW 1 PYo DR 27 DW 2 PYo DL 28 DW 3 PYo DR 28 :DO :L :T :DO :L :T :DO :L :T :DO :L :T :RA .*** DW 4 PYo DL 28 DW 5 PYo DR 28 DW 6 PYo DL 30 DW 7 PY o DR 30 :L :T :DO :T K H (kOO DR 31 DW O PYo Select register set O Store register set Basic address (byte +0) :DO :L :T :DO :L :T :DO :L :T .*** DW 2 PYo DR 24 DW 3 PYo DR 25 DW 4 PYo DR 26 Read status register 1 Address byte +2 :L :T :DO :T KH DR DW PY O03B 0000 31 0 0 :L :DO :T :L :DO :T DR DW PY DR DW PY 8 1 0 9 2 0 Write control register 1 Address byte +1 :DO :L DW PY 4 0 Read status register 3 Address byte +4 Open working DB Disable interrupts Select register sat 1 Basic address (byte +0) Read counter value register 1 Address byte +0 (reg. byte 3) Address byte +1 (reg. byte 2) Address byte +2 (reg. byte 1) Address byte +3 (reg. byte O) Read counter value register 2 Address byte +4 (reg. byte 3) Address byte +5 (reg. byte 2) Address byte +6 (reg. byte 1) Address byte +7 (reg. byte O) Enable interrupts READ STATUS REGISTERS 1,2,3 Read status register 2 Address byte +3 Read status register 3 Address byte +4 WRITE CONTROL REGISTER 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 988-0KP21 Select register sat O Store register set Basic address (byte +0) Write control register 2 Address byte +2 7-9 Programming Exernple R 11/92 B: PROBEISTS5D FB 21 O04A O04B O04D O04E O04F 0 0 5 0 CONT 0051 0053 0054 0055 0056 0057 SEGMENT5 0056 005A O05B W5C O05D O05E O05F 0061 0062 0064 0066 0067 0069 O06B O06D O06E O06F 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 O07A O07B oo7c O07D SEGMENT 6 O07E Oo60 0061 0062 0063 0064 0065 0066 0067 0069 O06B Oo6c O06D O06E O06F Oo80 0091 0093 0094 0085 7 - 10 LEN=206 Shaat 2 :T DR 26 :TB D 26.2 =CONT :JC :STS Module still parameterizad? If yes: continue. If no: Stop! New atart required ;L :L DW 10 KM 0000000000000100 Set "parameterization" bit in control raaister 3 :DO :T DW PY Write control register 3 Address byte +3 :Ow 3 0 :*** WRITE LOAD REGISTER :L KH :T DR :DO DW :T PY 0058 Ooo1 31 0 0 :L DL :DO DW :T PY :L DR :DO DW :T PY :L DL :DO DW :T PY :L DR :DO DW :T PY 15 4 0 15 5 0 16 6 0 16 7 0 ;L :T :DO :T KH DR DW PY 0003 31 0 0 Select register set 3 Store register aat Basic address (byte +0) :L :DO :T :L :DO :T :L :DO :T :L :DO :T .*** DL DW Write load register 2 Address byte +4 (reg. byte 3) E: DW PY DL DW PY DR DW PY 17 4 0 17 5 0 18 6 0 18 7 0 KH DR DW PY 007E 0002 31 0 0 :L :T :DO :T ;L DL :DO DW :T PY :L DR :DO DW :T PY :L DL :DO DW :T PY :L DR :DO DW :T PY 19 4 0 19 5 0 20 6 0 20 7 :L :T :DO :T 0004 31 0 0 KH DR DW PY Select register set 1 Store register set Basic address (byte +0) Write load register 1 Address byte +4 (rag. byte 3) Address byte +5 (rag. byte 2) Address byte +6 (reg. byte 1) Address byte +7 (rag. byte O) Address byte +5 (rag. byte 2) Address byte +6 (rag. byte 1) Address byte +7 (reg. byte O) WRITE INTERRUPT REGISTER Select register set 2 Store register aat Basic addreas (byte +0) Write interrupt register 1 Address byte +4 (reg. byte 3) Address byte +5 (reg. byte 2) Address byte +6 (reg. byte 1) Address byte +7 (reg. byte O) 0 Select register set 4 Store register set Basic address (byte +0) 1P 281 Equipment Manuel @ siWI'IWIS AG 1992, Order No: 6ES5 996-0KP21 Programming Example R 11/92 FB 21 0086 0097 0098 0089 008A O09B Oo9c O09D O09E O09F ;L :DO :T :L :DO :T :L :DO OOAO OOA1 OOA2 OOA3 :T :L :DO :T .*** SEGMENT 7 OOA4 OOA6 :L :T OOA7 OOA6 OOA9 OOAA OOAB OOAC OOAD OOAE OOBO oOB1 OOB2 00s3 OOB4 OOB5 WB6 OOB7 SEGMENT8 0086 OOB9 OOBB OOBC OOBD OOBF ooco Oocl OOC2 OOC3 OOC4 00(% OOC7 OOC6 OOC9 SEGMENT9 OOCA LEN=206 Sheet 3 B: PROBEIST.S5D DL DW PY DR DW PY DL DW PY DR DW PY KH Write intern@ register 2 21 4 Address byte +4 (reg. byte 3) 0 Address byte +5 (reg. byte 2) 21 5 0 22 Address byte +6 (reg. byte 1) 6 0 22 Address byte +7 (reg. byte O) 7 0 OOA4 0001 31 0 0 WRITE INTERRUPT ENABLE REGISTER Select register set 1 Store register set Basic address (byte +0) :DO :T DR DW PY :L DR :DO :T DW PY 13 3 0 Write IR enable register 1 Address byte +3 :L KH 0003 :T :DO :T DR DW PY 31 0 0 Select register set 3 Store register set Basic address (byte +0) :L DR DW PY 14 3 0 :DO :T .*** :L DW :L :U24veti -2.5 V Output voltage for signal status "O" <3V Nominal output current 500 mA Maximum output current 600 mA Maximum delay time, switch on (low -> high) 120 peec Maximum delay time, switch off ( high -> low) 120 psec Umit frequency ~ 50 Hz Short circuit proof Yes Overload protection Yes Pulse duration, can be set 10 msedltlrl msec/500 msec Enable digital outputa* S5 BASP signal = O and U5Vnt within the tolerance range Potential isolation - Between 2 digital outputa - Between digital output and S5 bus, digital input and 5.2 V encoder supply No Yes Free wheeling diode for inductive loads (relay) required (circui~ + section 1.4.3) * ~ BASPfunction can bewitched off (+section 1.4.3). 8.2 Counting Frequencies I lhis information appiiesto aii counting and digitai inputs. Maximum counting frequency 8-2 I 250 kHz iP 281 Equipment Manual @ SieMenS AG 1992, Order No: 6ES5 996-0KP21 Technical Specifications R 11/92 8.3 Power Supply 5 V Supply Voltage vfa Basic Plug Connector Xl Nominal value 5V Lower limit 4.65 v Upper limit 5.25 V Maximum current consumption 600 mA 24 V Supply Voltage via Front Plug Connector X3 Static limits (including ripple) - Lower limit - Upper limit 20V 3(3V Dynamic limits - Lower limit value Duration Recovery time - Upper limit Value Duration Recovery time 500 msec 50 sac Ripple ~ 3.6 V~ 14.25 V 5 msec 10 sac 35V Maximum current consumption (depends on the output circuitry) 2.5 A Overcurrent protection Yes Voltage monitoring No 5.2 V Encoder Supply (Option) Nominal output voltage 5.2 V Average output voltage at O A load current 5.20 V Average output voltage at 350 mA load current 5.15 v Average output voltage at 700 mA load current 5.10 v Maximum output current 700 mA (350 mAkounter) Short circuit proof Yes Potential isolation Yes: from Dl, DQ end encoder supply 24 V Encoder Supply Nominal output voltage 24 V Minimum output voltage 17 v Maximum output voltage 30V Maximum output current 300 mA Short circuit proof Yes Potential isolation Yes: from Dl, S5 bus and encoder supply 1P 281 Equipment Manual @ .%31WIIS AG 1992, Order No: 6ES5 898-0KP21 8-3 R 11/92 Technical Specifications 8.4 Environmental Requirements Climatic Requirement Temperature - Operation o" c to 55" c Temperature change 10 K/h Condensation not permitted -40" c to 70" c Temperature change 20 K/h - Storage and transportation (in originai packaging) Air pressure - Operation Minimum 660 kPa (= 1500 m. a,s. I.) Maximum 1060 kPa Over this: Limited cooling capacity Minimum 660 kPa (= 350o m. a.s. i.) Maximum 1060 kPa - Storage and transportation (in original packaging) Mechanicei Requirements Vibration stress during operation In accordance with DIN IEC 66-2-6 10 Hz to 56 Hz: 0.075 mm displacement 56 Hz to 500 Hz: 9.8 msec-2 (= 1 g) Transportation stress of device (packed for transportation) in accordance with DiN iEC 66-2-6 5 Hz to 9 Hz: 3.5 mm displacement 9 Hz to 50 Hz: 9.8 msec-2 (= 1 g) Topple/drop of device (not packaged) In accordance with DIN IEC 66-2-31 Fall height 50 mm Faiiing over (packaged) in accordance with DIN IEC 66-2-31 Electromagnetic Compatibility Radio suppression (interference emission) In accordance with VDE 0671, iimitvalue ciass A Interferenceimmunity against iine-conducted interferences ondirectcurrent suppiy and signal lines leaving the device in accordance with IEC 601 -4 (burst): 1 kV Interference immunity against static electricity discharge in accordance with IEC 601 -2: 8 kV Interference immunity againat HF radiation In accordance with IEC 601 -3: to 3V/m Protective and safety Measurea Protection ciaas Degree of protection - IP 281 in S5 subrack - IP 281 not instalied lnaccordancewithVDEO106-1 (iEC536) class Ili (safety extra low voitage) 1P 20 1P OCl A fan subassembly is not required. 8-4 1P 281 Equipment Manual @ siWIN?IW AG 1992, Order No: 6ES5 996-0KP21 Technical Specifications R 11192 In Which Slots Can the Counter Module Be Operated? 8.5 The CPUS which can be used are listed in section 1.2. Programmable Controller in Module Subrack Slot Designation = Q IP281 can be operated in~is slot. Central controller S5-115U CR 700-OIA S5-115u/ S5-115H CR 700-OLB S5-115U CR 7W)-1 S5-115u/ S5-115H CR 700-2 S5-115LV S5-115H CR 700-3 Pa CPU o :.:.::::::;:::;:\:;jj .......... . . . ......................... Pa CPU o 2 I 1 ::::::::::: ........... ::::::::::: . :::::::::::::::::::::.:.: ::::::::?:::::;:;<< ........... .. ..... .. .. .. .. .. ...... . ..... :.:.:.:.:.: ........... :.:.:.:.:.: .:.:.:.:.:.:.:.:.:.:.:.:.: ::.:....:.:.:.:.:::::+:. ........... .......................... .. Pa CPU o Pa CPU 0 Pa CPU Pa o Ps o 1 2 1 2 3 IM 3 [M 3 4 5 5 o 1 2 3 1+4. . . . ....I .,.,.,.,.:.,.,.,.,.,.:.,. I I .......... ........... .:.,.:.,.,. .:.:.>:j<::.+::>,< . ?..-..<+.:.:.... .,,..:.... .:... ......................... :,:,:,:,:,: :,:,:,:,:,: :,:,:,:,:,: :,:,:,:,:,: :,:,:,:::,: :,.:.,.:.:. . . ........ .......<...:.:.:,.*.:.:.: ,:<,:ZZ::2:::,.:, <.,... . :,:,:,:,:,: :,:,:,:,:,: .... ....... ........ ..... . .:.:.::.:.:,,:.:.>:<*<:; ........... ...........:,:,:,:,:,: ........... ...........:,:,:,::,: ,V.v..:,:,.:.,.,. ........ ............ .>. .s=,.. . . ... .................. 6 IM 6 IM ER 701-3` Expansion unit 1 2 I ER 701-3LH Central controller S5-135U Central mntroller s5-155u/ 3 I S5-155H Expansion unit S5-183U 3 Expansion unit S5-184U6 11 19 27 35 43 51 5s 67 75 63 91 99 07 15 123 131 139 147 155 63 ~g;E3igx:iz*;#;#:%#3g*:E%2#$%;#$#:;:3:E%iE#i##i$%;#?#;g:%Ig%if##I;#:] Expansion unit S5-185U Expansion unit S5-186U 3 19 131 147 I 63 I The 1P 281 counter module cannot be installed in expansion units ER 701 -1, ER 701-2 and EU 187U. 1) Starting with release status 6ES5 701-3LA13, interrupt processing can be used in the expansion unit using optical fiber coupling 6ES5307-3UA1 1 and6ES5317-3UA11. 2) Only one interrupt line each available (+ equipment manual of the PLC) 3) Only after jumpers on the bus PCB are changed 4) Functionality very restricted since interrupt lines are not available. 5) Interrupts are only connected via lM307/lM317. 6) Only via interface 300-5/312-5 since EU 184U is not equipped with a power supply. 1P 281 Equipment Manual @ SieffIenS AG 1992, Order No: 6ES5 998-0KP21 8-5 R 11/92 Technical Specifications 8.6 Connection Cables for Incremental Encoders 8.6.1 Connection Cable for Siemens Incremental Encoder 6FC9320 (RS 422 with 5.2 V Supply Via 1P 281) Order no: 6ES5 703-1000 (See ST52.3/54.l catalog.), max. length 32 m l+ O Cable exit: bottom 1 Cable exit: top BFO: 5 m CBO: 10 m CCO: 20 m CC5: 25 m CD2: 32 m 1P 281 I ,., , , snlela on ,.. . -, -, snlela on housing housing h 15 14 m 13 D 12 I I ~ < 1 II I I m II I 1 II m I br \ ilE m 6 m 7 bk II I rd \ 11X 10 m 11 Line 4 x 2 x 0.25 + 2 x 1 mm2 N < ( 5 I I I 1 [i 9Y I I Wt GND br IJ I I I 1 gn 5V2 I h I I pk N Shaft encoder < 8 I I I I I 1 II I 6 ( ( 1 ( 3 ( 4 2 12 . 10 11 ~ Outer cable diameter 8.9 mm ::... D. * tines twisted in pairs * 1 9 8I 1+1 8-6 15 Sub D plug connector 15-way pin (crimp) Connection side Metallized housing with screw lock 6FC9 341-lHC Round plug connector 12-way socket Connection side Siemens 6FC9 431-IFD 1 9 0 80 ~"~o :22 3 0 ~1 06 boo Q 1P 281 Equipment Manual @ siC!fTWIS AG 1882, Order No: 6ES5 996-0KP21 Technical Specifications R 11/92 Connection Cable for Incremental Encoder in Accordance with RS 422 (5 V Signals; 5.2 V Supply Via 1P 281) 8.6.2 6Es5 703-20000 (See ST52.3/w.l catalo9.), m=. length 32 m l-l 0 Cable exit: bottom 1 Cable exit: top Order no: BFO: 5 CBO: 10 CCO: 20 CC5: 25 CD2: 32 m m m m m Shaft encoder 1P 281 Shield on housing I Line 4 x 2 x 0.25 + 2 x 1 mm2 15 m 14 m 13 m 12 m 10 m 11 m 6 7 m m rd II I I II 1 K ~ 1 ii II I I I I 1 I I I 1 !J bk < \ ~ N < N br n I I I I I 1 [ 1 I I gn I I w I I I pk I II 5V2 M GND br I 1 I 1 1 g Cable end open Outer cable diameter 8.9 mm 1 :.:. D ." . . 8 \ * Lines are twisted in pairs Sub D plug connector 9 15-way pin (crimp) Connection side Metallized housing 1 5 wi~ s~ew Id 6FC9 341-lHC 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 8-7 R 11/92 Technical Specifications 8.6.3 Connection Cable for Incremental Encoder in Accordance with RS 422 (5 V Signals; 24 V Supply Via 1P 281) 6ES5703-31XIIZU (See ST52.3/54.l catalog.), max. length 32 m ~1 O Cable exit: bottom 1 Cable exit: top Order no: BFO: 5 m CBO: 10 m CCO: 20 m CC5: 25 m CD2: 32 m 1P 281 Shaft encoder -. . . , snlela an housing I (-1 15 9 14 m rd II 13 m I II I 12 II 10 m 11 m tine 4 x 2 x 0.5 mm2 it ~ < I ye \ ~ ti I bl I I N + + I I I I 7 m i i 9Y II N pk GND br 1 8 :. ,. .0 :: . . . I I I I I I 1 II II -- -- I II I I I I I 1 gn II 5 h I I Cable end open Outer cable diameter 10.3 mm * Lines twisted in pairs Sub D plug cannactar 15-way pin (crimp) Connection side Metallized housing 15 with screw lock 6FC9 341-1 HC 9 + 1P 281 Equipment Manual 8-8 @ siWm??E AG 1992, Order No: 6ES5 986-0KP21 Technical Specifications R 11/92 Connection Cable for 24 V Incremental Encoder (24V Signals; 24V Supply Via IP281) 8.6.4 6ES5 703-4000 (See ST52.3/54.l catalog.), max. length 100 m + O Cable exit: bottom 1 Cable exit: top Order no: BFO: 5 m CBO: 10 m CCO: 20 m CC5: 25 m CD2: 32 m Shaft encoder 1P 281 Shield on housing I I /-) I I 1 m 4 m 8 m 5 m 7 m 9 1 8 * I :0 ,. . . . . . . . . m i I Line 4 x 2 x 0.5 mm 2 I A* I B* I I I I 1 I I 1 I 24 V GND I ~E I I ~ 15 I I I I I I I I I I I N* II 9 I I I I I I I h I I I 1 II I I I I I I g Cable end open Sub D plug connector 15-way pin (crimp) Connection side Metallizad housing with screw lock 6FC9 341-lHC + IP 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 888-0KP21 8 - 9 R 11/92 Technical Specifications 8.7 Requirements on the Input Signals Precise functioning of the module requires that the input signals on the encoder inputs and digital inputs meet definite specifications with regard to puke width and time in relation to one another. 8.7.1 Pulse Widths of the Encoder Inputs Counting signals The input signals on the encoder inputs must have the following minimum puke widths. I I A T1 I T2 + AJB/N or 24 V encoder Encoder in accordance with RS 422 Signals on digital inputs I L Maxirn.rnCo.ntingFreq.ency Tlmin I I T2min 250kHz 4 paec 1.6 psec 50kHz 20 paec 8 ~ec 1 kHz 1 msec 400 paec I Maximum Counting Frequency I Tlmin I T2min I 1.6 paec 4 psec The input signals on digital inputs STA, STO and SET must have the following minimum pulse widths. I - I T2 L I I I STIVSTOISET I T1 Tlmin Maximum Signal Frequency T2min 4 peec 1.6 25 kHz 40 pec 16 ~ec 0.1 kHz 10 msec 4 msec 250 kHz 8 - 10 @ siWIN?IW WC 1P 281 Equipment Manual AG 1882, Order No: 6ES5 998-0KP21 R 11/92 8.7.2 Technical Specifications Time Relationships Between Counting Signals A and B/A* and B* The input signals on encoder inputs A and B must meet the following requirements. Times for encoder inputs 8.7.3 Tlmin T2min T3min 250 kHz 4 p-sac 1.6 ~ec 0.8 ~ec 50 kHz 20 p.sec 8W 4 paec 1 kHz 1 msec 400 paec 200 paec Max. Counting Frequency Time Tables for Encoder Inputs and Digital Inputs These tables are the basis for the calculation of time relationships in the following sections. Times for 24 V encoder inputs Max. Counting Frequency I Min. Delay, Emin 250 kHz 50 kl-iz 1 kl-lz Times for RS 422 encoder inputs I Max. Counting Frequency Max. Counting Frequency %31THIS 2.5 paec 125 psec I 7 psec 400 paec Min. Delay, Emin Max. Delay, Emax o 300 nsec Min. Delay, Dlmin I Max. Delay, Dlmex 250 kHz 0.6 ~ec 1.9 psec 25 kHz 5 paec 14 pec 0.1 kz 1.4 msec 3.5 msec 1P 281 Equipment Manual @ I Max. Delay, Emex 1.4 paec 0.5 paec 250 kHz Times for digital inputs I 1 1 AG 1992, order No: 6ES5 888-0KP21 8 - 11 I R 11192 Technical Specifications 8.7.4 Time Relationships for HW Gate Control 1 Counting edge = rising edge W I I l....~ T1 & . . . . STA Ii I i i Gate control via pulse { Gate control via level 1 Counting edge = rising and falling edge IW I L... L!LL--L I T1 . . . . STA i i Gate control via pulse { STO - - - - - Id 1 I , I I I Gate control via level 1 = First pulse to be counted 2 = Last pulse to be counted 3 = First pulse not to be counted T1 min = Dlmax - Emin + 0.4 ~sec T2min = Emax - Dlmin + 0.6 @ec The tables in section 8.7.3 apply. Although non-adherence to the time relationships will not cause undefined states on the module, the munter may deviate by 1 (more than 1 for high frequencies on the encoder input and large filter constants on the Dl). 8 - 12 1P 281 Equipment Manuel @ SiemenS AG 1992, Order No: 6ES5 998-0KP21 Technical Specifications R 11/92 8.7.5 Time Relationships for Load Procedures Loading the counter via STA Operating modes OCHG and CCHG s,. ~ I Loed counter (internal signal) Tlmin = Dlmin + 0.7 ~sec Tlmax = Dlmax + 0.7 ~ec The time table for DI in section 8.7.3 applies. Loading the counter via zero pulse (synchronization) Loading in upward direction SET I T2 ~ I Load counter (internal signal) T1 min = Dlmax - Emin + 0.4 psec T2min = Emax - Dlmin + 0.4 psec T3min = Emin + 0.4 psec T3max = Emax + 0.4 psec The time table in section 8.7.3 applies. T1 and T2 must be adhered to ensure that the counter is loaded. Loading in downward direction I N 1- T1 Load counter (internal signal) I T3 w T1 min = Dlmax - Emin + 0.4 psec T2min = Emax - Dlmin + 0.4 psec T3min = Emin + 0.4 p.sec T3max = Emax + 0.4 psec The time table in section 8.7.3 applies. T1 and T2 must be adhered to ensure that the counter is loaded. 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 8 - 13 Definition of Terms R 11/92 BASP Disables command output. This signal is sent when the central module goes into stop status. The signal disables the digital outputs. CCHG Cyclic counting procedure with hardware gate start, an autonomous operating mode Ccss Cyclic counting procedure with software gate start, an autonomous operating mode CONC Continuous counting, an autonomous operating mode CPU Central processing unit CRS Counter running status, the last position of the counter CVR Counter value register DB Data block DI Digital input DQ Digital output DQAO DQ active from alarm value (i.e., interrupt value) to overflow, a method of operation of the digital output DQAU DQ active from alarm value (i.e., interrupt value) to underflow, a method of operation of the digital output DQID DQ active for an adjustable impulse duration when the alarm value (i.e., interrupt value) is reached - counting down, a method of operation of the digital output DQIU DQ active for an adjustable impulse duration when the alarm value (i.e., interrupt value) is reached - counting up, a method of operation of the digital output DQNU DQ not used, a method of operation of the digital output DQS DQ status DW Data word EDQ Enable digital output EDS Enable downwards setting ESD Electrostatic sensitive devices/modules EUS Enable upwards setting EVDI Directional evaluation EVFT Four-time evaluation 1P 281 Equipment Msnuel @ %Mt3fIS AG 1992, Order No: 6ES5 998-0KP21 D-1 R 11/92 Definition of Terms EVOT One-time evaluation Two-time evaluation FB Function Mock GALE Level gating (i.e., hardware gate control with level) GAPU Pulse gating (i.e., hardware gate control with pulse) GEN Gate enable GFS Gate function selection (i.e., select type of gate control) GSS Gate-start-stop GST Gate stop (i.e., EMERGENCY OFF gate stop) IFR Interrupt enable register IIR Interrupt information register IOM Illegal operating mode 1P Intelligent peripheral (1/0) module IR Interrupt LED Light emitting diode LOS Load per software OB Organization block OCHG One-time counting procedure with hardware gating (i.e., one-time counting with hardware gate start), an autonomous operating mode Ocss One-time counting procedure with software start (i.e., one-time counting with software gate start), an autonomous operating mode OVF Overflow, upper counting range limit exceeded PLC SIMATIC S5 programmable controller RES13 Reset pulse for the module SC2A Start counter 2 when alarm value (i.e., interrupt value) in counter 1 is reached, a combination operating mode SEP Standard slot SET Digital SET input SPE Setting performed (synchronization) STA Digital start input STEP 5 Programming language used to program the SIMATIC S5 family D-2 1P 281 Equipment Manuel @ &3TN3fM AG 1882, Order No: 6ES5 986-0KP21 Definition of Terms R 11192 STO Digital stop input SYC Synchronous control SYR Synchronous read LJNF Underflow. Lower counting range limit has been passed below. TCAR Transfer counting value to alarm register (i.e., interrupt register), a combination operating mode TCLR Transfer counting value of counter 1 to load register of counter 2, a combination operating mode ZMPC Zero marking pulse of encoder 1 to counter 2, a combination operating mode 1P 281 Equipment Manual @ sk3m131W AG 1992, Order No: 6ES5 998-0KP21 D-3 Index R 11/92 A Address area, 2-3 Address bits, 2-3 Cyclic program, 7-5 D Address decoding, 2-3 Diagnostic LEDs, 1-5 Application area, 1-2 Digital inputs, 1-19 Basic address, 2-3, 3-2 Basic module, 1-3 Basic setting after RES=, 5-4 BASPj 1-20 Block circuit diagram, 6-40 c Digital output, 1-20, 6-34 Basic setting, 6-35 Enable, 6-34 Methods of operation Interrupt value pulse, counting down, 6-39 Interrupt value pulse, counting up, 6-38 Interrupt value to overflow, 6-37 Interrupt value to underflow, 6-36 Switch off, 6-35 Status, 6-35 DIL switch, 2-3 Dimensions, 1-3 CCHG, 6-15 Direction evaluation, 6-5 CCSS, 6-13 DQAO, 6-37 Command run times, 1-22 DQAU, 6-36 Commissioning, 5-1 DQID, 6-39 Communication with SIMATIC S5, 1-22 DQIU, 6-38 CONC, 6-8 DQNU, 6-35 Continuous counting, 6-8 DQS, 6-35 Control counter synchronously, 6-28 Counting direction, 5-8, 6-5 E Counting mode, 6-2 EDQ, 6-34 Counting pulse evaluation, 6-4 EDS, 6-26 Counting range, 6-2 EMERGENCY OFF gate stop, 6-33 Counting range limit, 6-3 Counting width, 6-2 Encoder interface, 1-13 24 V encoder, 1-14 In accordance with RS 422 (5 V), 1 -17 Counting with one counter, 1-16 Encoder supply (24 V), 1-16 CRS, 3-14 Encoder supply (5 V), 1-18 CVR (counter status register), 3-9 EUS, 6-26 Cyclic counting, 6-13, 6-1 5 EVDI, 6-5 Counting settings, 6-2 1P 281 Equipment Msnusl @ siemenS AG 1992, Order No: 6ES5 998-0KP21 l-l R 11/92 Index EVFT, 6-5 Interrupt line, 2-6 EVO~6-4 Interrupt line selection, 4-2 EVTT,6-4 Interrupt processing, 4-1, 4-2, 7-6 Interrupt program, 4-1, 7-6 F Front plate, 1-5 Interrupt value, 3-7, 4-9 Inverting the input signals, 6-6 IOM, 5-7 Functional setup, 1-10 Fuse, 1-21 G GALE, 6-32 GAPU, 6-31 Gate control, 6-30 Activation of, 6-31 EMERGENCY OFF gate stop, 6-33 Hardware gate control Via level, 6-32 Via pulses, 6-31 Software gate control, 6-33 L Limit frequency, 1 -14, 1 -19 Load resistance, 1-1 4 Loading by S5, 6-23 Loading the munter, 6-23 Loading with zero pulse, 6-24 LOS, 6-23 GEN, 6-30, 6-31 Manual new start, 7-4 GFS, 3-16 Mechanical setup, 1-3 GSS, 6-33 Method of operation of the counters, GSTj 6-33 H Hysteresis At overflow/underflow, 6-3 Of the interrupt value 4-9 1-1 1 Minimum pulse duration, 1-20 Mounting the plug-in submodule, 1-4 o OCHG, 6-11 OCSS, 6-9 I IFR (Interrupt enable register), 3-11 Offset, 2-3, 3-2 One-time counting, 6-9, 6-1 1 IIR (Interrupt information register), 3-12 Operating modes, 6-7 Autonomous operating modes, 6-7 Common operating modes, 6-17 input signals, requirements of, 8-10 Operating modes overview, 5-9 Installation width, 1-3 Order number, 1-2 Internal gate, 6-30 Overflow, 6-3 Interrupt Acknowledgement, 4-5 Acquisition, 4-5 Reaction time, 4-4 Sources, 4-6 OVF, 5-5 Interrupt evaluation, 4-3 Parameterization DB, 7-4 I-2 P 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 996-0KP21 Index R 11/92 Plug connector allocation, 1-7 24 V SUf@y, 1-9 Basic plug connector, 1-7 Digital inputs and outputs, 1-9 Encoder inputs, 1-8 Plug-in jumpers, 2-7 BASP function, 2-7 Input filter, 2-8 Minimum pulse duration DQ, 2-9 Selecting the encoder interface, 2-11 Selecting the reference potential, 2-12 Wire break recognition, 2-1 O SC2A, 6-21 Sn, 6-24 Setting elements Basic module, 2-1 Plug-in submodule, 2-2 SPE, 6-23 STA, 6-31 , 6-32 Startup, 7-4 Startup behavior, 5-3 Status register, 5-5 Plug-in submodule, 1-3 SYC, 6-28 Potential isolation, 2-1 1,2-1 2 Synchronization, 6-24 Process interfaces, 1-1 2 SYR, 6-29 Program example, 7-1 Pulse width, 8-10 R RC filter, 1-14, 1-19 Reading the counter, 6-29 Reference potential, 1-13 T TCAR, 6-18 TCLR, 6-19 Time relationships Between counting signals, 8-1 1 For HW gate mntrol, 8-12 For loading procedures, 8-13 Register address, 3-2 Register set, selection of 3-4 Registers, 3-1 Control register, 3-16 Counting value register, 3-9 Interrupt information register, 3-1 2 Interrupt register, 3-7 Load register, 3-5 Overview, 3-1 8 Parameter register, 3-16 Reading, 3-3 Select register, 3-4 Selection, 3-2 Status register, 3-1 4 Writing, 3-3 u Underflow, 6-3 UNE 5-5 v Voltage supply for encoder, 1-21 w RESR behavior, 5-4 Wire break recognition, 1-1 7 Restart after return of voltage, 7-4 Working DB, 7-4 s Saving the register set address, 7-4 1P 281 Equipment Manual @ Siemens AG 1992, Order No: 6ES5 998-0KP21 z Zero marking pulse counter, 6-20 I-3 To: Siemens AG Bereich Automatisierungstechnik Kombinationstechnik (B1 .2-TI) Postfach 2355 Suggestions Corrections For equipment manual D-90713 Furth/Bay. Order no. From: If you find typographical errors while reading this document, please use this form to let us know. Name Com~anv/department We would also be grateful for your suggestions, remarks or ideas. Address Please fill in the order no. of the affected document. Telephone I Suggestions orland corrections: