Siemens Simatic S5 IP 240 Manual
Siemens Simatic S5 IP 240 Manual

Siemens Simatic S5 IP 240 Manual

Counter/positioning/position decoder module
Hide thumbs Also See for Simatic S5 IP 240:
Table of Contents

Advertisement

Quick Links

SIMATIC S5
IP 240
Counter/Positioning/
Position Decoder Module
Manual
EWA 4NEB 811 6120-02b
Edition 03

Advertisement

Table of Contents
loading

Summary of Contents for Siemens Simatic S5 IP 240

  • Page 1 SIMATIC S5 IP 240 Counter/Positioning/ Position Decoder Module Manual EWA 4NEB 811 6120-02b Edition 03...
  • Page 2 Siemens has developed this document for its licensees and customers. The information contained herein is the property of Siemens and may not be copied, used, or disclosed to others without prior written approval from Siemens. Users are cautioned that the material contained herein is subject to change by Siemens at any time and without prior notice.
  • Page 3 IP 240 Replacement Pages for IP 240 Manual, Edition 3 Supplement to the IP 240 Manual, Order No. 6ES5 998 0TB22, Edition 3 Use of the IP 240 in the S7-400 programmable controller This manual has been supplemented by Appendices A, B and C. They include information on how to install S5 modules in an S7-400 programmable controller when using an adapter casing.
  • Page 4: Table Of Contents

    Preface Introduction System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning Direct Data Interchange with the IP 240 Response Times Encoder Signals Error Messages Appendices Index EWA 4NEB 811 6120-02b...
  • Page 5 IP 240 Preface Preface In addition to open and closed-loop control, the programmable controllers of the SIMATIC S5 fa- mily execute special tasks such as positioning and counting. So that these auxiliary functions do not unnecessarily load the central processor (S5 CPU), they are handled by standalone "intelli- gent"...
  • Page 6 Your comments will help us to improve the next edition. Courses SIEMENS provide SIMATIC S5 users with extensive opportunities for training. For more information, please contact your SIEMENS representative. Reference Literature This manual is a comprehensive description of the IP 240.
  • Page 7 Introduction IP 240 • Automating with the S5-115U SIMATIC S5 programmable controllers Hans Berger Siemens AG, Berlin and Munich 1989 Contents: - STEP 5 programming language - Program processing - Integral blocks - Interfaces to the peripherals Order No.: ISBN 3-8009-1526-X •...
  • Page 8 IP 240 Introduction Conventions In order to improve the readability of the manual, a menu-style breakdown was used, i.e.: • The individual chapters can be quickly located by means of a thumb register. • There is an overview containing the headings of the individual chapters at the beginning of the manual.
  • Page 9 Introduction IP 240 Manuals can only describe the current version of the programmable controller. Should modifications or supplements become necessary in the course of time, a supplement will be prepared and included in the manual the next time it is revised. The relevant version or edition of the manual appears on the cover.
  • Page 10 IP 240 Introduction Conventions The following conventions are used in this book and are listed for your reference: Convention Definition Example A box that indicates a type of hazard, describes its implications, and tells you how to avoid the hazard is a cautionary statement.
  • Page 11: System Overview

    System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning Direct Data Interchange with the IP 240 Response Times Encoder Signals Error Messages EWA 4NEB 811 6120-02a...
  • Page 12 Figures 1-1. Modes of the IP 240 Module ......... 1 - 1 1-2.
  • Page 13 IP 240 System Overview System Overview Intelligent input/output modules (I/Os) extend the field of applications of the SIMATIC S5 programmable controller system. They are technology-oriented and off-load the central pro- cessor by preprocessing the input signals. Digital input modules can resolve pulses up to a frequency of 100 Hz. The IP 240 can be used for applications with higher frequencies and for connecting incremental encoders.
  • Page 14 System Overview In the position decoding, counting and positioning modes, the 1P can be used as a standalone module in the U-range programmable controllers S5-1 15U, S5-135U (CPU 922 and 928), S5-150U and S5-155U. Operation as an expansion to the 1P 252 closed-loop control module with direct data exchange between the 1/0 modules is only possible in the S5-1 15U programmable controller.
  • Page 15: Module Description And Accessories

    System Overview Module Description and Accessories General Technical Specifications ......2 - 1 Technical Specifications .
  • Page 16 Figures 2-1. Front Connectors ........... 2 - 4 2-2.
  • Page 17 IP 240 Module Description and Accessories Module Description and Accessories General Technical Specifications Climatic Environmental Conditions Mechanical Environmental Conditions Temperature Vibration to IEC 68-2-6 Operation 0 to +55 °C - Tested with 10 to 57 Hz, (Intake air tem- (constant ampli- perature, tude 0.15 mm) measured at the...
  • Page 18 Module Description and Accessories IP 240 Technical Specifications The IP 240 has two independent channels. In the IP 252 expansion mode, the encoder signals are acquired as in the position decoding and positioning modes. The data relating to pulse inputs for position decoding therefore also apply to the IP 252 expansion.
  • Page 19 IP 240 Module Description and Accessories Input frequencies Pulse inputs: Symmetrical signals max. 500 kHz in position decoding and positioning mode max. 200 kHz in IP 252 expansion mode - Asymmetrical signals max. 50 kHz 24 V max. 25 kHz for 100 m cable max.
  • Page 20 Module Description and Accessories IP 240 2.2.3 Inputs/Outputs The IP 240 provides two options for connecting sensors to the pulse inputs: • All sensor signals can be routed to the 15-pin subminiature D socket connectors X2/X4 ( Section 4.2.2) • Clock signals up to 10 kHz can also be routed over the 7-pin plug connectors X3/X5 ( Section 4.2.2).
  • Page 21 IP 240 Module Description and Accessories Data for rated voltage 24 V sym.pulse train A*, B*, Z* A*, B*, Z* A, A, B, B, Z, Z IN, CLK, GT IN, CLK, GT Input voltage ranges to RS 422 A ”0”-Signal ”1”-Signal 0 ...+0.8 V - 30 ...+...
  • Page 22 Module Description and Accessories IP 240 Digital outputs Number of outputs 4 (2 per channel) Galvanic isolation in groups of Supply voltage Vp Rating 24 V DC Ripple 3.6 V max. Permissible range (including ripple) 20 to 30 V Output current for ”1” signal 0.5 A max.
  • Page 23 IP 240 Module Description and Accessories Encoder supply The power supply for 5 V encoders is taken from the programmable controller's power supply and made available over subminiature D socket connectors X2 and X4 (pins 4 and 10) ( Section 4.2.2). If 24 V is needed, the IP 240 must be powered via the external connection on connector X6 provided for this purpose (24 V, 0 V).
  • Page 24 Wickmann No.TR5F 19370K 1.6 A T Wickmann No.TR5T 19372K 1.0 A T Wickmann No.TR5T 19374K Position encoders with symmetrical signals e.g. Siemens, No. 6FC9320-... Connecting cables for 6FC9320-3..00 position decoders 6ES5 705-3BF01 10 m 6ES5 705-3CB01 20 m 6ES5 705-3CC01...
  • Page 25: Addressing

    System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning Direct Data Interchange with the IP 240 Response Times Encoder Signals Error Messages EWA 4NEB 811 6120-02a...
  • Page 26 Figures 3-1. Locations of the Address Switches ........3 - 1 EWA 4NEB 811 6120-02a...
  • Page 27 IP 240 Addressing Addressing The IP 240 module reserves an address space of 16 bytes in the I/O areas. All data are exchanged via these areas, which can be read out and written to by the S5 CPU. The data transfer is handled by a standard function block.
  • Page 28 Addressing IP 240 Programmable I/O area Starting Switch settings controller address Address area I/O area S5-115U S5-135U S5-150U S5-155U extended I/O area EWA 4NEB 811 6120-02a...
  • Page 29 IP 240 Addressing Use of the IP 240 in the S5-183U, S5-184U, S5-185U and S5-186U expansion units If you use the IP 240 in one of these EUs, set the start address on switchbank S3 as explained above. Setting the I/O area or the extended I/O area: •...
  • Page 30: Hardware Installation

    System Overview Module Description and Accessories Addressing Hardware Installation Installation ..........4 - 1 4.1.1 Suitable Programmable Controllers and Expansion Units...
  • Page 31 Figures 4-1. Connectors ............4 - 4 4-2.
  • Page 32 IP 240 Hardware Installation Hardware Installation Installation 4.1.1 Suitable Programmable Controllers and Expansion Units The IP 240 can be used as a compact module without fan subassembly in the following PLC central controllers: • S5-115U with adapter casing • S5-135U with CPU 922 (from Version 9 onwards) and CPU 928 (from 6ES 928-3UA12 onwards) •...
  • Page 33 Hardware Installation IP 240 S5-115U expansion unit, ER 701-3 subrack Note If the IP 240 is operated in an ER 701-3 expansion unit, interface modules 304 and 314 or 307 and 317 are required. S5-135U central controller, MLFB 6ES5 135-3KA.. S5-135U central controller, MLFB 6ES5 135-3UA..
  • Page 34 IP 240 Hardware Installation S5-183U expansion unit S5-184U expansion unit S5-185U expansion unit 155 163 S5-186U expansion unit IRx interrupt signals cannot be generated in these expansion Possible slots units. Note When interrupts are generated over I/O byte 0, all interrupt-generating modules must be operated in either the central controller or in an expansion unit.
  • Page 35 1P 240 Hardware Installation Wiring 4.2.1 Wiring Method X2 and X4 Shield Fixing screw, 4-40 VNC-2B thread Screw-type terminal max. permissible torque 0.5 Nm Plug-in connector (7-pin) X3 and X5 Cable entry Plug-in connector (2-pin) X6 Fig. 4-1. Connectors Permissible cross-sections of conductors 2 and 7-pin plug-in connector 0.5 to 1.5 mmz (20 to 15 AWG) - Stranded conductor H07V-K with sleeve...
  • Page 36 Hardware Installation 4.2.2 Connector Pin Assignments Front Connector Pin Assignments X21X4 – A Encoder signal A, sym. ‘ 150 Encoder signal~, sym. — i i Ground Ground 1 4 0 — B Encoder signal B, sym. Encoder signal~, sym. 1 3 0 Ground —...
  • Page 37 Hardware Installation IP 240 Shielding of cable connections on the IP 240 Warning To ensure noise immunity, shielded twisted-pair cables must be used for all IP 240 connections (inputs, outputs, 24 V power supply). The following applies to shielding of the connecting cables: •...
  • Page 38 IP 240 Hardware Installation Installation Examples 4.3.1 Inputs Three-wire BERO X3/X5 – M (L–) Four-wire BERO X3/X5 – M (L–) A1 has NO function (”1” signal) A2 has NC function (”0” signal) Fig. 4-3. Connection of BERO Proximity Switches Note Only inductive proximity switches with outputs switching to L+ potential can be connected to the 24 V inputs of the module.
  • Page 39 Hardware Installation IP 240 Incremental Encoders (with symmetrical outputs to RS 422 A) Receiver electronics Encoder electronics Connector X2/X4 1.6 A T Channel set to symmetrical Cable driver to encoder Connect shield DIN 66 259 signals to frame I/O Standard RS 422 A Fig.
  • Page 40 IP 240 Hardware Installation Incremental Encoders (with asymmetrical outputs) Receiver electronics Encoder electronics Connector X2/X4 Channel set to 24 V and asymmetrical encoder signals 1 A T M (L-) Fig. 4-5. Connection of Encoders with Asymmetrical Signals: Push-Pull Encoder Output Circuit Note Ground connection M(L-) must have as low a resistance as possible.
  • Page 41 Hardware Installation IP 240 External pull-up resistors Encoder electronics Receiver electronics Connector X2/X4 Channel set to 24 V and asymmetrical encoder signals Fig. 4-6. Connection of Encoders with Asymmetrical Signals: Open-Collector Encoder Output Circuit Note All encoders whose output circuitry allows a load with respect to ground and meets the required input level can be connected.
  • Page 42 IP 240 Hardware Installation SIEMENS provides the following prefabricated cables for connecting a 6FC9320-3..00 incremental encoder to the IP 240: Cable designation IP 240 pulse encoder (6FC9320-... with SIEMENS circular connector) Order No. 6ES5 705-3xxx1 xxx = Length code 5 m BF0...
  • Page 43 Hardware Installation IP 240 4.3.2 Outputs X3/X5 ((1887/3)) Vs=Supply voltage Fig. 4-8. Connecting the Load to the Digital Outputs on the IP 240 Note All digital outputs are isolated from each other and from the module ground. Warning Because of internal protective diodes, if the cables to D+ and D - are connected the wrong way round, the outputs are bypassed.
  • Page 44: Operation

    System Overview Module Description and Accessories Addressing Hardware Installation Operation Settings for Interrupt Generation ......5 - 2 5.1.1 IRx Interrupt Circuits .
  • Page 45 Figures 5-1. Locations of Switchbanks and Fuses ........5 - 1 5-2.
  • Page 46 IP 240 Operation Operation Before startup you must set various coding switches on the module. You can stipulate • interrupt generation with switchbanks S1 and S2 ( Section 5.1) • disabling of the digital outputs in the event of active BASP signal with switchbank S4 ( Section 5.2) •...
  • Page 47 Operation IP 240 Settings for Interrupt Generation The processing of interrupt signals makes it possible to respond rapidly to status changes. In the SIMATIC S5 programmable controllers, a distinction is made between two types of inter- rupts: • ”Servicing IRx interrupt circuits” (S5-115U, S5-135U and S5-155U in the 155U mode) •...
  • Page 48 IP 240 Operation If several IP 240 modules use one interrupt circuit, the current interrupt source must be determi- ned by reading the interrupt request bytes of all modules or by additionally evaluating I/O byte 0. This must be taken into account in the STEP 5 program due to the system characteristics of the S5-115U CPUs ( Section 5.1.2).
  • Page 49 Operation IP 240 Switchbank S1 Switchbank S2 PB 0.0 I/O byte 0.0 to 0.7 Master or Slave Enable for I/O byte 0 Fig. 5-3. Allocation of Coding Switches on Switchbanks S1 and S2 to Interrupt Generation with I/O Byte 0 The coding switches on banks S1 and S2 shown in Fig.
  • Page 50 IP 240 Operation Example for setting the coding switches Three IP 240s are to be enabled for interrupt generation. One IP 240 is to be operated as master module and the other two as slave 1 and slave 2. Slave 1 is assigned to PY 0.1 and slave 2 to PY 0.2. Bits PY 0.3 to PY 0.6 are reserved by other modules.
  • Page 51 Operation IP 240 Additional programming in the organization blocks for the S5-115U: a) The interrupt service routine must be programmed in an FB so that it may execute several times. • I/O byte 0 must be read once at the beginning of interrupt processing to determine which IP triggered the interrupt.
  • Page 52 IP 240 Operation Matching to Encoder Signals You can connect the following to the IP 240 as position encoders: • symmetrical incremental encoders with 5 V differential signals complying with RS 422A via inputs A/A, B/B, Z/Z • asymmetrical incremental encoders with 5 V DC or 24 V DC signals via the inputs A*, B* and You can connect encoders with 5 V DC or 24 V DC signals to the CLK, GT and IN binary inputs.
  • Page 53: Functional Description

    System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Module Functions ......... . . 6 - 1 6.1.1 Modes .
  • Page 54 Figures 6-1. Data Interchange in Programmable Controllers with Multiprocessor Capability ........6 - 8 Tables 6-1.
  • Page 55: Position Decoding

    IP 240 Functional Description Functional Description Module Functions The IP 240 is an intelligent I/O module for acquiring and preprocessing encoder and counting pulses. The module has two channels and can be initialized for the relevant application via the user program. 6.1.1 Modes The IP 240 can be operated in the positon decoding, counting, positioning and IP 252 expansion...
  • Page 56: Counting

    Functional Description IP 240 6.1.2 Digital Outputs The digital outputs on the module can be used for direct driving of actuators and displays for particular process states (actual values). The digital outputs can be set to a predefined state by the user program. This takes place at a higher level than when the outputs are set as a function of the actual value.
  • Page 57: Ip 252 Expansion

    IP 240 Functional Description Wirebreak/short-circuit (red WB LED) When a channel is set to symmetrical pulses, the encoder cable is monitored by evaluating the two pulse trains of an encoder track. Detection of a wirebreak/short-circuit is indicated separately for each channel for the duration of the fault condition with the red WB (WireBreak) LED. Hardware fault (red MF LED) The red MF (Module Fault) LED indicates a hardware fault on the module.
  • Page 58: Positioning

    Functional Description IP 240 6.2.1 Configuring Function Blocks Configuring function blocks serve to select the modes. Each mode is assigned its own function block: • FB 167 for positioning mode ( Section 10.23.2) • FB 169 for position decoding mode ( Section 7.3.1) •...
  • Page 59 IP 240 Functional Description Restart Characteristics 6.3.1 Power On After ”Power on” a test routine is initiated on the IP 240 to verify proper functioning of the module. If the routine executes without error, the module is in a wait state which allows configuring of the channels.
  • Page 60 Functional Description IP 240 Table 6-2. Error Flagging in the PAFE Byte Bit number Error category Exact error de- PAFE byte scription in DB Hardware faults, communication and data errors DW 8 to 10 DW 13 Parameter and data errors Data block number entered is illegal, data block does not exist or is too short, CPU not permissible...
  • Page 61 IP 240 Functional Description 6.4.2 Parameter and Data Errors Parameter errors When parameter errors occur, the function block sets bit 1 in the PAFE byte. Parameter errors occur when • the function block is not compatible with the IP firmware •...
  • Page 62 Functional Description IP 240 Multiprocessor Operation In the S5-135U and S5-115U PLCs with multiprocessor capability,the IP 240 can also be used when these PLCs are equipped with more than one processor. Note that an IP 240 can be addressed by one processor only. The IP 240 must be assigned to the CPU with which it is to interchange data.
  • Page 63: Response Times

    System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Application ..........7 - 1 Principle of Operation .
  • Page 64 Figures 7-1. Counting Direction in Position Decoding Mode ......7 - 1 7-2. Actual Value and Overrange in Position Decoding Mode .
  • Page 65 IP 240 Position Decoding Position Decoding Application In this mode, the IP 240 can be used in all applications in which position changes are to detected and decoded using incremental encoders. The module can process encoder pulse trains with a fre- quency of up to 500 kHz for symmetrical encoders and 100 kHz for asymmetrical encoders.
  • Page 66: Encoder Signals

    Position Decoding IP 240 Changing the counting direction To change the counting direction, you must interchange the encoder signal connections as follows: • for symmetrical encoders, interchange A/A and B/B. • for asymmetrical encoders, interchange A* and B*. Actual value range and overrange The actual value range is defined as - 99,999 to+99,999.
  • Page 67 IP 240 Position Decoding The zero offset value thus always offsets the zero point of the actual value range to the reference point. A zero offset can be revoked by transferring a ”0” value to the IP. Configuring FB 169 does not transfer the zero offset entered in the DB.
  • Page 68 Position Decoding IP 240 Example: The position encoder emits 1000 pulses/revolution. The spindle has a gradient of 50 mm/revolu- tion. The position encoder therefore emits 1000 pulses for a distance of 50 mm. The IP 240 pro- cesses up to 199,998 increments within the defined actual value range. This results in the following traversing ranges: Table 7-1.
  • Page 69 IP 240 Position Decoding Transfer of the initial values from the data block to the IP 240 The limit values are initially transferred to the IP with configuring FB 169. During operation, you can enter modified limit values with control FB 170. •...
  • Page 70 Position Decoding IP 240 Triggering a process interrupt Every REFn bit can trigger a process interrupt when it goes from 0 to 1 (rising edge). You must indicate which REFn bits are to trigger interrupts by setting the corresponding bits (0 to 7) in the PRA1 parameter for configuring FB 169.
  • Page 71 IP 240 Position Decoding If you set bit DIGn/9 to ”0”, a change in the REF bit from 0 to 1 sets the output only when the actual value enters the track over a track limit. Note If DIGn/9 is set to ”0”, actual value-dependent triggering of process interrupts is disabled until the end of the next module firmware cycle in the following cases: •...
  • Page 72 Position Decoding IP 240 Actual value Forwards Backwards TRACK1 ANF1 END1 Status bit REF1 ANF2 END2 TRACK2 Status bit REF2 ANF7 END7 TRACK7 Status bit REF7 Interrupt Setting/resetting the outputs during con- figuring with DIG1/8=0 DIG2/8=1 DIG1/8=1 DIG2/8=0 The interrupt request is reset when the interrupt request bytes are scanned. Fig.
  • Page 73 IP 240 Position Decoding Traversing speed and track width In order for entry into a track to be detectable in every module firmware cycle, the traversing speed must be matched to the minimum track width. The encoder pulses acquired by the IP are counted in a counter chip. The current (internal) count is read out once in each module firmware cycle and then postprocessed to produce the (external) actual value.
  • Page 74 Position Decoding IP 240 Defining the hysteresis The hysteresis can be preset in BCD in the data block in data byte DR 22 ( Section 7.3.3) in the range 0 to 99. It applies to all tracks of a channel and is only transferred to the IP 240 during a configuring pass.
  • Page 75 IP 240 Position Decoding If the direction is reversed outside the hysteresis range following switching of an output, the switching point at the track limit is retained ( Fig. 7-7). Entry into the track Actual value Reversal of direction Output Exit from the track Actual value...
  • Page 76 Position Decoding IP 240 The output is switched analogously upon entry into and upon exit from the upper track limit. The output is reset when the actual value reaches the ”upper track limit+hysteresis”. (without Fig.) b) Setting of an output Fig.
  • Page 77 IP 240 Position Decoding 7.2.5 Forcing the IP Outputs You can use control bits DAnF and DAnS (n=1 for digital output 1 or n=2 for digital output 2) to indicate whether output D1 or D2 • is to be enabled for actual value-dependent switching by the IP (if so, set DAnF to 0 and DAnS to 1 in DL17) •...
  • Page 78 Position Decoding IP 240 In addition, the following are carried out on the basis of the specified configuring data: • any outputs that are set are reset • an interrupt is generated for DRBR or NPUE and interrupt bit DRB or NPU is set in the interrupt request bytes.
  • Page 79 IP 240 Position Decoding Invoking the interrupt servicing OBs in the S5-150U and S5-155U PLCs (150 mode) In the S5-150U and S5-155U (150 mode), the associated interrupt servicing OB is invoked at the next block boundary when one of the bits in I/O byte 0 changes its values. Use the ABIT parameter in configuring FB 169 to specify whether the OB is to be invoked every time the bit changes its value or only when it goes from 0 to 1.
  • Page 80 Position Decoding IP 240 7.2.9 Reference Point Approach Since incremental encoders cannot indicate the absolute position after a power failure, a re- ference point must be approached to calibrate a measuring system. The location of the reference point is determined by the zero mark or reference signal (Z signal) emitted by the encoder during a preliminary signal.
  • Page 81 IP 240 Position Decoding Aborting a reference point approach The reference point approach initiated by setting the REFF bit is normaly terminated, following synchronization, with a negative-going edge at the preliminary contact input. If, despite this, it is still necessary to exit a reference point approach, this can be done by resetting the REFF bit: •...
  • Page 82: Error Messages

    Position Decoding IP 240 Initializing Standard Function Blocks and Data Block Assignments 7.3.1 Configuring Function Block FB 169 (STRU.WEG) Configuring data and parameter for operation of the IP 240 in the position decoding mode Functional description The configuring function block initially checks the parameter assignments and then transfers the general module data (machine-readable product code of the module, firmware and hardware version) from the IP to the specified data block.
  • Page 83 IP 240 Position Decoding Table 7-5. Parameters for Configuring FB 169 Name Para- Data Description meter type type BGAD Module starting address KANR Channel number DBNR Data block number Resolution of encoder pulses Zero mark monitoring DIG1 Assignment of digital output D1 to reference tracks 1 to 8 DIG2 Assignment of digital output D2 to reference tracks 1 to 8 PRA1...
  • Page 84 Position Decoding IP 240 DIG1 : KM 0000 0000 Bit 0 to Bit 7: 0000 0000 Assignment of digital output D1 to reference tracks 1 to 8 Bit n = 1 Output D1 is set with assigned reference bit 0000 0011 1111 1111 Bit n = 0 Output D1 is not set with assigned reference bit...
  • Page 85 IP 240 Position Decoding PRA2 : KM 0000 0000 Assignment of a process interrupt to bits in the status area 0000 0000 Bit n= 1 A process interrupt is generated when status bit is ”1” Bit n= 0 No process interrupt is generated when status bit is ”1” 0000 0000 0000 0111 Bit 0 :...
  • Page 86 Position Decoding IP 240 Technical Specifications Block number : 169 Block name : STRU. WEG Call length/ Library number Processing time Block length S5-115U P71200-S 5169-D-2 12 words/ 941-7UA... approx. 350 ms 1098 words 942-7UA... approx. 150 ms 943-7UA... approx. 944-7UA...
  • Page 87 IP 240 Position Decoding 7.3.2 Control Function Block FB 170 (STEU.WEG) Control function block for position decoding mode. Functional description The control function block first verifies whether the addressed channel has been configured for the ”position decoding” mode. In accordance with the parameter assignments of the function block, certain data areas are then transferred from the data block to the IP 240 or updated in the DB by reading them from the IP 240.
  • Page 88 Position Decoding IP 240 Note Scratch flags and system data areas are used in the standard function blocks for the purpose of data interchange with the IP 240 ( Technical Specifications for the FBs). You must therefore • save these flags and data areas at the beginning of the service routines for the S5-115U, S5-135U (when set for interrupt servicing at block boundaries) and S5-115U (155U mode) and reload them at the end of these routines.
  • Page 89 IP 240 Position Decoding 7.3.3 Contents of the Data Block The data block to be created must comprise at least 68 words (DW 0 to 67). The number of the selected data block must be entered under parameter DBNR when an FB is called. DW 0 DW 30 Actual value (IST)
  • Page 90 Position Decoding IP 240 Control bits Data byte DL 17 AMSK DA2F DA2S DA1F DA1S DR 17 REFF AMSK =1 All process interrupts for the channel are masked, i.e. lost Enable process interrupts DA2F DA2S Digital output D1 is reset Digital output D2 is set on the basis of the mode in dependence on the actual value Digital output D2 is set irrespective of the actual value DA1F DA1S...
  • Page 91 IP 240 Position Decoding Interrupt request byte for Channel 1 and Channel 2 Data byte DL 20 Channel 1 DR 20 Channel 1 DL 21 Channel 2 DR 21 Channel 2 Process interrupt was initiated by positive-going edge of corresponding reference bit REFn DRB =1 Process interrupt was initiated by wire break monitoring...
  • Page 92 Position Decoding IP 240 Identifiers of tracks used Data byte DL 29 DR 29 The track limits for this track are to be transferred The track limits for this track are not to be transferred Actual value (IST) in BCD code Data byte DL 30...
  • Page 93 IP 240 Position Decoding Final value of the first track (END 1) Data byte DL 36 DR 36 DL 37 DR 37 The final value is negative Permissible range: - 99,999 to + 99,999 The final value is positive DWs 38 to 65 contain the initial and final values of tracks 2 to 8 Example of track limit arrangement: - 1200 - 700...
  • Page 94 Position Decoding IP 240 An Example of Position Decoding: Heat Treatment The induction coil of an induction furnace for heat treatment must move at different speeds over different sections of the workpiece to compensate for cross-section variations and achieve the same hardness over the whole length of the workpiece.
  • Page 95 IP 240 Position Decoding Functional description All data required for operation must be entered in a data block (DB 10 in the example). The data include: • the speed at which the furnace moves over the various zones of the workpiece, •...
  • Page 96 Position Decoding IP 240 Stipulations Input card Module address Output card Module address Analog output card Module address 128 (1st output) IP 240 Module address (IRA enabled for S5-115U and S5-135U PY 0 enabled for S5-150U) Data block 10 - Speeds (in binary) KF+ 1024=maximum forward speed KF - 1024=maximum backward speed - Zone limits (BCD code in the range 0 to +99,999)
  • Page 97 IP 240 Position Decoding Inputs, outputs, flags, timers and counters used OPERAND SYMBOL COMMENT I 4.0 EMERG STOP I 4.1 START START RUN I 4.2 ON INTPNT TRANSFER OF A NEW INITIAL POSITION I 4.3 FORWARD SELECT NEW INITIAL POSITION FOR THE FURNACE I 4.4 BACK SELECT NEW INITIAL POSITION FOR THE FURNACE...
  • Page 98 Position Decoding IP 240 DB10 LEN=38 KH = 0000; KF = +00250; Forward speed on initial point selection KF = -00250; Backward speed on initial point selection KF = +00750; Traversing speed in zone 1 KF = +00320; Traversing speed in zone 2 KF = +00600;...
  • Page 99 IP 240 Position Decoding DB12 LEN=73 KH = 0000; KS =' MACHINE-READABLE PRODUCT CODE OF THE MODULE Version of the firmware KS =' Hardware version KH = 0000; Error flags for KH = 0000; hardware and KH = 0000; communications errors KH = 9001;...
  • Page 100 Position Decoding IP 240 DB20 LEN=35 KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000;...
  • Page 101 IP 240 Position Decoding Start routine FB 20 Reset the flag areas used Configure IP 240 channel 1 for position decoding output ”RET INTPNT” 7-37 EWA 4NEB 811 6120-02a...
  • Page 102 Position Decoding IP 240 Cyclic program FB 21 Begin in progress? Q ”RET INTPNT” set? Enable set and start button pressed? FB 22 FB 24 Load forward speed ”FORW” pressed? into FW 14 Reset Q ”READY” Set Q ”RUNNING” Transfer zone limits (from DB 10 to DB 12) Parameterize track 8 to turning point...
  • Page 103 IP 240 Position Decoding Operation/traverse program FB 25 Begin FB 25 Backward traverse program active? Forward traverse program active? Enter speed for zone 1 in FW 14, switch on heating, set F ”FORW ACTIV” Feedback from interrupt service routine: F ”FIN POINT”set? Switch off heating, set 8th track to 0, write track limits...
  • Page 104 Position Decoding IP 240 Control and output program FB 26 Begin FB 26 Error bit EMERG STOP” Limit switch set? pressed? pressed? (FY 11) Set Q Set Q ”FAULT”, Switch on Q ”STOPPED” save FY 11 in FY 10 and delete ”STOPPED”...
  • Page 105 IP 240 Position Decoding Interrupt service routine FB 27 and FB 28 FB 27 Read interrupt req. (FB 170 FCT 3) FB 28 Interrupt from channel 1? Interrupt Set bit for wirebreak triggered by switch off heating, wirebreak? reset FW 14 Backward traverse program active?
  • Page 106 Position Decoding IP 240 OB 1 LEN=8 NETWORK 0000 CYCLE 0000 0001 NAME :IP PROG 0002 OB 2 LEN=16 NETWORK 0000 PROCESS INTERRUPT PROGRAM 0000 SAVE SCRATCH FLAGS 0001 NAME :FLAG.SAV 0002 DBNR : 0003 0004 INTERRUPT SERVICE ROUTINE FOR THE IP 240 0005 NAME :INTERPT 0006 0007...
  • Page 107 IP 240 Position Decoding FB 20 LEN=52 NETWORK 1 0000 CONFIGURE IP 240 CHANNEL 1 FB20 : CONFIGURE CHANNEL 1 AND PRESET PROGRAM FLAGS CHANNEL 1 OF THE IP240 IS CONFIGURED FOR POSITION DECODING MODE AND PROVIDED WITH INTERRUPT IDS. THE FLAG AREAS USED BY THE PROGRAM ARE FIRST RESET AND THEN PRESET.
  • Page 108 Position Decoding IP 240 FB 21 LEN=33 NETWORK 1 0000 ORGANIZATION PROGRAM FB21 : ORGANIZATION PROGRAM FB21 IS THE ORGANIZATION BLOCK FOR THE SAMPLE PROGRAM NAME :IP PROG 0005 12.3 -RET INTPNT 0006 :JC =FOR1 INITIAL POINT SELECTION PROGRAM 0007 12.1 -RUNNING 0008...
  • Page 109 IP 240 Position Decoding FB 22 LEN=34 NETWORK 1 0000 REDEFINE INITIAL POINT FB22 : REDEFINE/ADJUST INITIAL POINT OF THE FURNACE AS LONG AS ONE OF THE TWO KEYS IS PRESSED, THE FURNACE IS MOVED IN ONE OF THE TWO DIRECTIONS WITH THE SPEED STORED IN DB10 (DW1/DW2).
  • Page 110 Position Decoding IP 240 FB 23 LEN=75 NETWORK 1 0000 TRANSFER OF INITIAL POINT FB23 : TRANSFER INITIAL POINT WHEN INPUT ”ON INTPNT” IS ACTIVATED, THE ACTUAL VALUE IS READ AND SET TO ZERO BY A ZERO OFFSET NAME :OFFSET 0005 -ON INTPNT 0006...
  • Page 111 IP 240 Position Decoding FB 23 LEN=75 0041 12.5 -FAULT 0042 END 0043 -ON INTPNT 0044 12.1 -EDGE SET EDGE FLAG 0045 4.2 = ON INTPNT TRANSFER OF THE NEW INITIAL POINT 12.1 = EDGE EDGE FLAG OF I ”ON INTPNT” = AUX BYTE1 SCRATCH FLAG CYCLIC PROGRAM 11.5 = PAFE ZERO...
  • Page 112 Position Decoding IP 240 FB 24 LEN=97 NETWORK 1 0000 START RUN FB24 : START RUN / TRANSFER TRACK LIMIT VALUES FB 24 TRANSFERS THE TRACK LIMIT VALUES STORED IN DB10 (DW12 - DW28) TO THE WORKING DATA BLOCK OF THE IP 240 AND THEN, USING FB170, TO THE IP 240.
  • Page 113 IP 240 Position Decoding FB 24 LEN=97 003E KF +28 TRANSFER DW13 - 28 ? 0040 :>F 0041 :JC =FOR1 0042 0043 -AUX WORD2 INCREMENT COUNTER BY 2 0044 0045 -AUX WORD2 0046 0047 -AUX WORD3 0048 :JU =BACK 0049 FOR1 : 004A 004B KH 0009...
  • Page 114 Position Decoding IP 240 FB 25 LEN=67 NETWORK 1 0000 OPERATION / TRAVERSE PROGRAM FB25 : OPERATION / TRAVERSE PROGRAM OF THE INDUCTION FURNACE FB25 ENTERS THE INITIAL OR RETURN SPEED OF THE FURNACE INTO FW14 AND PARAMETERIZES A CONTROL TRACK (TRACK 8), IF NECESSARY, TO MOVE THE FURNACE BACK TO ITS ORIGINAL POSITION.
  • Page 115 IP 240 Position Decoding FB 25 LEN=67 12.4 = BACK ACTIV BACKWARD TRAVERSE PROGRAM ACTIVE 12.2 = FORW ACTIV FORWARD TRAVERSE PROGRAM ACTIVE = ANALOG VAL ANALOG VALUE TO BE OUTPUT IN UNITS (MAX. 1024) 12.4 = HEATING HEATING ON (CONTACTOR + INDICATOR) 12.6 = FIN POINT FINAL POINT OF THE FORWARD TRAVERSE PROGRAM REACHED 12.3 = BACK START...
  • Page 116 Position Decoding IP 240 FB 26 LEN=75 NETWORK 1 0000 ERROR/INTERRUPTION CONTROL FB26 : CONTROL PROGRAM FOR EMERGENCY STOP, MALFUNCTIONS OR LIMIT SWITCHES FB26 QUERIES INPUTS ”EMERG STOP”, ”LMTSW FORW” AND ”LMTSW BACK” AND RESPONDS TO PARAMETER ASSIGNMENT ERRORS IN THE STANDARD FBS FOR THE IP240. ON AN EMERGENCY STOP, THE ”EMERG STOP”...
  • Page 117 IP 240 Position Decoding FB 26 LEN=75 0030 =CHEK 0031 =END 0032 PRO2 : 0033 -ANALOG VAL IF DOWN COUNTING, 0034 KB 0 RESET OUTPUTS 0035 :<F 0036 =CHEK 0037 =END 0038 CHEK: 0039 12.1 -RUNNING 003A 12.2 -ENABLED 003B 12.3 -RET INTPNT 003C...
  • Page 118 Position Decoding IP 240 FB 27 LEN=26 NETWORK 1 0000 INTERRUPT SERVICE ROUTINE FOR THE IP 240 FB27 : INTERRUPT ORGANIZATION BLOCK FOR THE SAMPLE PROGRAM INTERRUPT CAUSE/SOURCE IS DETERMINED AND THE APPROPRIATE INTERRUPT PROGRAM (IN THIS CASE FB28) IS CALLED. NAME :INTRT 0005 FB 170...
  • Page 119 IP 240 Position Decoding FB 28 LEN=81 NETWORK 1 0000 INTERRUPT SERVICE ROUTINE FOR THE IP 240 CHANNEL 1 FB28 : INTERRUPT SERVICE ROUTINE CHANNEL 1 OF THE IP240 PRECISE CAUSE OF INTERRUPT IS DETERMINED AND THE APPROPRIATE RESPONSES ACTIVATED. ON WIREBREAK OR REACHING ONE OF THE TWO FINAL POINTS (INITIAL POINT/TURNING POINT) OF THE TRAVERSE PATH OF THE FURNACE, THE DRIVE IS SWITCHED OFF AND A FLAG SET WHICH IS EVALUATED IN THE CYCLIC PROGRAM.
  • Page 120 Position Decoding IP 240 FB 28 LEN=81 0039 REF8 : 003A 16.7 REF8 (CUTOFF POINT) 003B =OUTP 003C 12.6 -FIN POINT BIT FOR FINAL POINT FORWARD REACHED 003D =OUT1 003E FOR2 : 003F 16.7 REF8 (INITIAL POINT) 0040 12.7 -INT POINT 0041 =OUT1 0042...
  • Page 121 IP 240 Position Decoding FB 38 LEN=39 NETWORK 1 0000 SAVE FLAGS FB38 SAVES FLAG WORDS 200 TO 254 IN A SPECIFIED DATA BLOCK. THE DATA BLOCK MUST HAVE A LENGTH OF AT LEAST 30 DATA WORDS (DW0 - DW29). NAME :FLAG.SAV :DBNR I/Q/D/B/T/C: B...
  • Page 122 Position Decoding IP 240 FB 39 LEN=37 NETWORK 1 0000 LOAD FLAGS WRITE THE STATES OF FLAG WORDS 200 - 254 SAVED BACK TO THE FLAG WORDS. THE DATA BLOCK SPECIFIED MUST HAVE A LENGTH OF AT LEAST 30 DATA WORDS (DW0 - 29). NAME :LOAD.FLG :DBNR I/Q/D/B/T/C: B...
  • Page 123 IP 240 Position Decoding FB 169 LEN=47 NETWORK 1 0000 NAME :STRU.WEG :BGAD I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :KANR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :DBNR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :AFL I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :IMP I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :DIG1 I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KH :DIG2 I/Q/D/B/T/C: D...
  • Page 124: Direct Data Interchange With The Ip

    System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting Applications ..........8 - 1 Principle of Operation .
  • Page 125 Figures 8-1. Actual Value Range and Overrange in Counting Mode ....8 - 1 8-2. Sequence Diagram for Counting Mode ....... . 8 - 4 8-3.
  • Page 126 IP 240 Counting Counting Applications In this mode, the IP 240 can be universally used for pulse counting. The module can process pulse trains with frequencies of up to 70 kHz. Principle of Operation For the counting mode the following STEP 5 modules are necessary: •...
  • Page 127 Counting IP 240 When the defined actual value range is exceeded, the counter enters overrange and the IP sets status bit UEBL (overflow). When set, the UEBL bit can trigger an interrupt. You must indicate whether or not it is to do so via the PRA parameter during configuring ( Section 8.3.1).
  • Page 128 IP 240 Counting 8.2.2 Final Value Storing the final count When you evaluate the actual value, you are evaluating the current count. The IP also makes the actual value of the preceding count available, i.e. the count value at the instant of the first negative GATE signal.
  • Page 129 Counting IP 240 The following options are available for forcing the output: a) The digital output is to be set when the actual value reaches ”0”, and reset on the first pos- itive GATE signal edge following the start of a new count. In this case, you must set control bits DA1F to 0 and DA1S to 1 in DL 17.
  • Page 130 IP 240 Counting 8.2.4 Flagging with Status Bits Status data is updated in every cycle of the module firmware on the IP. If you want information about the status, you must call control FB 172 and parameterize function 1 ”Read actual value, final value and status bits” ( Section 8.3.2).
  • Page 131 Counting IP 240 8.2.5 Interrupt Generation and Processing Status bits REF1, REF2, UEBL and UEBS can trigger an interrupt and are stored in the interrupt request bytes on the IP with their positive-going edges as RF1, RF2, UEB and UBS ( Section 8.3.3). Reading the interrupt request bytes After an interrupt request, an interrupt service organization block is called by the CPU.
  • Page 132 IP 240 Counting Initializing Standard Function Blocks and Data Block Contents 8.3.1 Configuring Function Block FB 171 (STRU.DOS) Configuring and parameter assignments for operation of the IP 240 in counting mode Functional description The configuring function block first checks the parameter assignments and then transfers the general module data (machine-readable product code of the module, firmware and hardware versions) from the IP to the data block specified.
  • Page 133 Counting IP 240 Table 8-1. Parameters for Configuring FB 171 Para- Name meter Data Description type BGAD Module starting address KANR Channel number DBNR Data block number Assignment of digital output D1 Assignment of process interrupt Control of count enabling PAFE Error flag byte Address space (normal and extended I/O areas)
  • Page 134 IP 240 Counting : KH 0000 to 0001 Control of count enabling by external or internal starting signal Bit 0=1 Control of start of count by active signal at GT input Bit 0=0 Control of start of count by active control bit STRT PAFE : QB Flag byte or output byte (0 to 239) in which any errors are flagged ( Section 6.4)
  • Page 135 Counting IP 240 Technical Specifications Block number : 171 Block name : STRU. DOS Call length/ Library number Processing time Block length S5-115U P71200-S 5171-D-2 9 words/ 941-7UA... approx. 72 ms 814 words 942-7UA... approx. 46 ms 943-7UA... approx. 30 ms 944-7UA...
  • Page 136 IP 240 Counting 8.3.2 Control Function Block FB 172 (STEU.DOS) Control function block for counting. Functional description The control function block first verifies whether the addressed channel has been configured for counting mode. Depending on the parameters assigned to the function block, certain data areas are transferred from the data block to the IP 240, or updated in the DB by reading them from the IP 240.
  • Page 137 Counting IP 240 Note In the standard function blocks, scratch flags and system data areas are used for data interchange with the IP 240 ( Technical Specifications for the FBs). You must • save these scratch flags and data areas at the beginning of the interrupt service routines for the S5-115U and S5-135U (when interrupt servicing after each statement is enabled) and for the S5-155U (155U mode) and reload them at the end of these routines.
  • Page 138 IP 240 Counting 8.3.3 Contents of the Data Block The data block to be created must have least 36 words (DW0 to DW 35). The number of the selected data block must be entered under parameter DBNR when calling an FB. DW 0 DW 29 DW 1...
  • Page 139 Counting IP 240 Control bits Data byte DL 17 AMSK DA1F DA1S DR 17 STRT AMSK =1 All process interrupts for the channel are masked, i.e. lost Process interrupts enabled DA1F DA1S Digital output D1 is reset Digital output D1 is set and reset on a mode-dependent basis Digital output D1 is set irrespective of the actual value STRT =1 Enable a count...
  • Page 140 IP 240 Counting Interrupt request bytes for channel 1 and channel 2 Data byte DL 20 RF 2 RF 1 Channel 1 DR 20 Channel 1 DL 21 Channel 2 DR 21 Channel 2 Process interrupt was triggered by a positive-going edge of reference bit REF1 (”0”...
  • Page 141 Counting IP 240 Actual value The specified value is an absolute value. The sign (SG) is indicated in the status area (DW 19). Actual value in BCD Data byte DL 30 DR 30 DL 31 DR 31 Actual value in binary Data byte DL 32...
  • Page 142 IP 240 Counting Example for Counting: Fast Filling with Loose Material The throughput in filling with loose material is measured using a pulse encoder. This encoder drives the counter on the IP 240 directly. When the specified setpoint is reached, the valve is closed by the IP 240 hardware. •...
  • Page 143 Counting IP 240 Inputs, outputs, flags, timers and counters used OPERAND SYMBOL COMMENT EMERG STOP START FILL PUSHBUTTON TO ACTIVATE PROPORTIONING PROCEDURE Q 4.0 OPEN VALVE OUTPUT TO OPEN THE VALVE FILLING INDICATOR, LIT DURING PROPORTIONING FY 8 AUX BYTE SCRATCH FLAG BYTE IN IP240 PROGRAM F 10.0 FILL ACTIV...
  • Page 144 IP 240 Counting DB14 LEN=43 KH = 0000; KS =' MACHINE-READABLE PRODUCT CODE OF THE MODULE FIRMWARE VERSION KS =' HARDWARE VERSION KH = 0000; ERROR FLAGS FOR KH = 0000; HARDWARE AND KH = 0000; COMMUNICATIONS ERRORS KH = 8001; KH = 0000;...
  • Page 145 Counting IP 240 DB20 LEN=35 KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000; KH = 0000;...
  • Page 146 IP 240 Counting FB 40 initialization program Reset auxiliary flags Configure IP 240 (FB 171) FB41 cyclic program Begin Depending on cause Q ”FILLING” EMERG STOP flashes fast or slowly ”GROUPPAFE”? Reset F ”FILL ACTIV” F ”FILL ACTIV” set? I ”START FILL” pressed? Transfer initial count value (FB 172/FKT 4) Set and transfer DIG1S and STRT (FB 172/FKT 2)
  • Page 147 Counting IP 240 OB 1 LEN=8 NETWORK 1 0000 CYCLE 0000 :JU FB 0001 NAME :IP PROG 0002 OB 20 (For S5-115U: OB 21) LEN=9 NETWORK 1 0000 COLD RESTART 0000 0001 :JU FB CONFIGURING THE IP 240 0002 NAME :CONFIG 0003 OB 22 LEN=17...
  • Page 148 IP 240 Counting FB 38 LAE=39 NETWORK 1 0000 SAVE FLAGS FB 38 SAVES FLAG WORDS 200 TO 254 TO A SPECIFIED DATA BLOCK. THE DATA BLOCK MUST COMPRISE AT LEAST 30 DATA WORDS (DW0 TO DW29). NAME :FLAG.SAV :DBNR I/Q/D/B/T/C: B 0008 =DBNR...
  • Page 149 Counting IP 240 FB 39 LEN=37 NETWORK 1 0000 WRITE FLAGS FB39 WRITES THE STATES OF FLAG WORDS 200 TO 254 SAVED WITH FB 38 BACK TO THE FLAG WORDS. THE DATA BLOCK SPECIFIED MUST COMPRISE AT LEAST 30 DATA WORDS (DW0 TO DW29).
  • Page 150 IP 240 Counting FB 40 LEN=31 NETWORK 1 0000 CONFIGURING THE IP240 CHANNEL 1 CHANNEL 1 OF THE IP 240 IS CONFIGURED IN COUNTING MODE. DIGITAL OUTPUT 1 AND THE INTERNAL GATE CONTROL ARE ENABLED. THE CONTROL BITS ARE ALSO INITIALIZED AND TRANSFERRED. NAME :CONFIG 0005 :JU FB 171...
  • Page 151 Counting IP 240 FB 41 LEN=111 NETWORK 1 0000 ORGANIZATION BLOCK FOR CHANNEL1 FB41 CONTAINS THE PROGRAM FOR CHANNEL 1 OF THE IP 240 IN COUNTING MODE. NAME :IP PROG 0005 11.0 -GROUPPAFE 0006 -EMERG STOP 0007 :JC =CYCL 0008 10.0 -FILL-ACTIV RESET THE AUXILIARY FLAGS...
  • Page 152 IP 240 Counting FB 41 LEN=111 003F -AUX BYTE 0040 :><F 0041 11.0 -GROUPPAFE 0042 0043 REF1 0044 KB 1 0045 0046 =END 0047 OFFP :A -OPEN VALVE SWITCHOFF PROGRAM AND READING 0048 -OPEN VALVE FINAL COUNT VALUE AFTER 5 SEC 0049 KT 050.1 004B...
  • Page 153 Counting IP 240 FB 171 LEN=38 NETWORK 1 0000 NAME :STRU.DOS :BGAD I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KS/KG: KF :KANR I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KS/KG: KF :DBNR I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KS/KG: KF :DIG I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KS/KG: KH :PRA I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KS/KG: KH :EXT I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KS/KG: KH :PAFE I/Q/D/B/T/C: A BI/BY/W/D: BY...
  • Page 154 System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Speed Measurement with the IP 252; DRS Controller Structure . . . 9 - 1 Data Interchange between S5 CPU -- IP 240 -- IP 252 ... . . 9 - 3 Configuring .
  • Page 155 Figures 9-1. Speed Measurement with the IP 252 Closed-Loop Control Module ..9 - 1 9-2. Actual Speed Measurement via the IP 240 Module ..... . 9 - 2 9-3.
  • Page 156 IP 240 IP 252 Expansion IP 252 Expansion When the IP 240 is used with the IP 252 closed-loop control module, control lines, which are only implemented in the S5-115U programmable controller with a PS 7A/15A power supply, are re- quired to coordinate direct data exchange between the modules.
  • Page 157 IP 252 Expansion IP 240 By expanding the IP 252 with IP 240 modules, it is possible to provide two or more control loops with actual values from incremental encoders. In these cases, the IP 240 operates as a slave module for the IP 252. IP 252 Control loop 1 Branch 1...
  • Page 158 IP 240 IP 252 Expansion Data Interchange between S5 CPU -- IP 240 -- IP 252 During operation, data traffic between the IP 240 and the IP 252 is controlled by the closed-loop control module. CPU access to the backplane bus is prevented during the data interchange. The following data is stored by the IP 240, on request, in a transfer buffer on the IP 240 which can be read by the IP 252: •...
  • Page 159 1P 240 Expansion — Configuring When configuring the 1P 252 closed-loop control module, configuring switches — must W the for speed measurement so that the actual count is interrogated by the 1P 240. Furthermore, during initialization the 1/0 address and the assigned channel of the 1P 240 must also be specified. The 1P 240 is configured by calling function block FB 173 in restart organization blocks OB21 and OB22.
  • Page 160 IP 240 IP 252 Expansion Initializing the Configuring Function Block and Data Block Contents 9.4.1 Configuring Function Block FB 173 (STRU. 252) Configuring the module in the IP 252 expansion mode Functional description The configuring function block first checks the parameters and then transfers the general module data (machine-readable product code of the module, firmware and hardware version) from the IP to the specified data block.
  • Page 161 IP 252 Expansion IP 240 Note Interrupt servicing is not disabled in the configuring FBs. You must therefore write your STEP 5 program in such a way that the configuring FB cannot be interrupted. Interrupt servicing is disabled in the restart OBs. Technical Specifications Block number : 173...
  • Page 162 IP 240 IP 252 Expansion 9.4.2 Data Block Contents The data block to be created must have at least 25 words (DW 0=to DW 24). The number of the selected data block must be entered under parameter DBNR when the FB is called. DW 14 DW 0 DW 15...
  • Page 163 System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning 10.1 Application and Functional Description ..... . . 10 - 1 10.1.1 Application .
  • Page 164 10.13 Methods of Synchronization ....... . . 10 - 38 10.13.1 Reference Point Approach .
  • Page 165 Figures 10-1. Overview of IP 240 Configuring and Synchronization Options ..10- 1 10-2. Controlled Positioning with Two Speeds ......10- 2 10-3.
  • Page 166 Tables 10-1. Switching IP Digital Outputs D1 and D2 ......10- 3 10-2.
  • Page 167 IP 240 Positioning Positioning 10.1 Application and Functional Description 10.1.1 Application In this mode, the IP 240 enables controlled positioning with cut-off points. Incremental encoders must be used to generate the path-dependent signals. To acquire the enco- der signals, the IP 240 is equipped with counter chips which can process encoder signal trains of up to 500 kHz from symmetrical encoders and of up to 50 kHz from asymmetrical encoders.
  • Page 168 Positioning IP 240 10.1.2 Functional Description This section includes a brief description of the IP 240's method of operation in ”positioning” mode and provides explanations of terms used in subsequent sections. Configuring the IP, data interchange The IP 240 is a two-channel module. You can configure one or both channels for ”positioning” mode using configuring function block FB 167.
  • Page 169 IP 240 Positioning Zero point Starting Target (reference position position point) Position value of the target position Actual value Switching Cut-off of the point point starting position Range BEE2 Range BEE1 Fig. 10-3. Controlled Positioning with the IP 240 The IP 240's module firmware can control the traverse speed and the direction of travel directly over the IP's two digital outputs.
  • Page 170 Positioning IP 240 b) Switching and signalling ranges for a position During the approach to a target position, the IP 240 monitors the entry into ranges BEE1 and BEE2 in order to be able to control the drive. Overtravel and standstill of the axis after the drive has been switched off, however, must also be considered.
  • Page 171 IP 240 Positioning Approaching the position in positive direction Target position Approaching the position in negative direction BEE3 Status BEE2 Bits BEE1 RICH prior to invoking the target position Fig. 10-5. Status Bits on Approach to Position Example: The examples below will help you understand positioning from a positive and from a negative direction: Position data for the target position to be approached: Position value for the target position:...
  • Page 172 Positioning IP 240 b) Approaching the target position in negative direction The axis is at 1600 increments when the position is selected. The axis must travel in the nega- tive direction at the rapid traverse rate. • When the actual value is 1300, the traverse rate is switched to creep speed. •...
  • Page 173 IP 240 Positioning Table 10-3. Axis Types and Actual Value Ranges Axis types Linear axis Rotary axis Table 9,999,998 -9,999,999 +9,999,999 Maximum 9,999,999 to +9,999,999 0 to 9,999,998 actual value For a rotary axis, the IP 240 always chooses the direction so that the target position is reached along the shortest possible path.
  • Page 174 Positioning IP 240 b) The IP outputs control the direction of travel The IP 240 sets one or both outputs in dependence on the required direction of travel. D1 is set if travel in positive direction is required. D2 is set if travel in negative direction is required. The drive is switched off when the BEE2 range is entered.
  • Page 175 IP 240 Positioning To compensate backlash, you can specify that the IP output is to be disabled on a approach to position only when the direction of travel was positive (ascending actual value). If the position was approached in a negative direction, the IP output remains set and the position is ”overrun”. When the BEE2 range is exited, the output must be reset over the S5 CPU (via embedded commands to the IP 240).
  • Page 176 Positioning IP 240 c) Synchronization with an external control signal When this method is used, each positive signal edge at the IN input resets the actual value and reactivates the position last selected. Positioning can thus be started in dependence on the IN signal.
  • Page 177 IP 240 Positioning BCD representation If you require BCD-coded data for the purpose of documentation, definition or post-processing, you may choose this form of representation instead of binary. Position numbers and distance values for position 0, however, cannot be represented in BCD. ”1111”...
  • Page 178 Positioning IP 240 10.3.2 Data in the Data Block and in the Transfer Buffer If the data interchange with the IP 240 • is handled by standard function blocks, you must observe the contents of the data words in the data block when writing and evaluating data. •...
  • Page 179 IP 240 Positioning • 2-byte-data Two bytes are available for the following data items: - Distance value of range BEE3 for position 0 Table 10-6. Layout of a 2-Byte Data Item in the DB and in the Transfer Buffer Data Byte layout Offset in block...
  • Page 180 Positioning IP 240 Numerical representation and ranges for input and output values The table below provides an overview of the digit positions actually used and of the ranges for all input and output values. The table also shows, once again, in which cases you need binary and in which cases BCD representation for numerical values.
  • Page 181 IP 240 Positioning 10.4.2 Rotary Axis In the case of a rotary axis, the traverse path is closed and is not limited. A revolution can comprise a maximum of 9,999,999 increments. The rotary axis is defined by the following values: •...
  • Page 182 Positioning IP 240 Maximum traversing speed The encoder pulses acquired by the IP are counted in a counter chip. The current (internal) count is read once in every module firmware cycle and is then post-processed to form the (external) actual value.
  • Page 183 IP 240 Positioning 10.5 Switching the IP Outputs The IP 240 is equipped with two digital outputs (D1 and D2) for each channel. You have two options for influencing setting and resetting of the IP outputs: • You can determine the switching performance of the IP outputs when you configure the channel.
  • Page 184 Positioning IP 240 10.5.2 The IP Outputs Control the Traversing Speed When you configure DAV=0 or DAV=1, you pass control of the traversing speed to the IP outputs. The outputs are switched without regard to the direction of travel. a) Outputs are set separately (DAV=0) After the target position has been selected ( Fig.
  • Page 185 IP 240 Positioning Positive direction of travel Negative direction of travel Selection of Switching Position Selection of Switching Position the target points for the value for the the target points for the value for the position target position target position position target position target position...
  • Page 186 Positioning IP 240 Emergency limit switch Acts directly on the drive controller Hardware limit switch Acquired via S5 DI Preliminary contact Connected to the IP 240 Position Motor Axis slides encoder IP 240 S5 - DQ IP 240 left right left right rapid creep...
  • Page 187 IP 240 Positioning 10.6 Backlash Compensation (LOSE) Backlash in the position decoding system reduces the positioning accuracy. To prevent this, all positions and the reference point must always be approached from the same direction. The IP 240 supports this when you configure ”Backlash compensation”. Configuring backlash compensation You can specify backlash compensation by setting the ”LOSE”...
  • Page 188 Positioning IP 240 If the actual value is greater than the position value of a newly selected position, the positioning procedure must be subdivided into two steps: 1st step Select position ( Fig. 10-15: Actual value 9300). The drive is switched on and moves at rapid traverse speed in a negative direction toward the target position.
  • Page 189 IP 240 Positioning 10.6.2 Backlash Compensation during Reference Point Approach Compensation of the backlash during reference point approach ( Section 10.13.1) is similar to compensation during positioning. Synchronization is attained only when the reference point is approached in a positive direction. Decisive for evaluation of the direction is the instant at which the preliminary contact signal (connected to the IP's IN input) changes back to zero.
  • Page 190 Positioning IP 240 Actual value range and overrange The actual value range is defined as -9,999, 999 to +9,999,999. 9,999,999 - 1 0 9,999,999 + 1 to 9,999,999 0 + 1 to 9,999,999 Overrange Defined actual value range Overrange Fig. 10-17. Actual Value Range and Overrange in Positioning Mode When the defined actual value range is exited, the counter enters the overrange and the IP 240 sets the UEBL bit.
  • Page 191 IP 240 Positioning You specify the resolution in configuring parameter AFL: : JU FB 167 NAME : STRU.POS : KF x Single resolution Twofold resolution Fourfold resolution Example for a linear axis: An incremental encoder supplies 2500 pulses/revolution. The leadscrew has a pitch of 5 mm/revo- lution.
  • Page 192 Positioning IP 240 10.7.2 Zero Offset By transferring a zero offset (NVER), you can allocate a new actual value to the current position. You may also make a distinction as to whether or not actual-value matching should take the last (old) zero offset that was transferred into account.
  • Page 193 IP 240 Positioning b) Additive zero offset The new actual value is computed as follows when you specify an additive zero offset: Actual =Actual + Zero offset add.,new The actual value thus changes by the value of the additive zero offset transferred. Limit switch Reference point Limit switch...
  • Page 194 Positioning IP 240 The table below shows the contents of the data block for a zero offset. Binary representation BCD representation Data byte DL 45 DR 45 DL 46 DR 46 DL 47 DR 47 A negative value must be spe- The high-order nibble of DL 46 cified as two's complement.
  • Page 195 IP 240 Positioning 10.8 Position Data for Positions 1 to 254 Position data includes: • the position value designating the absolute location of the position in the traversing range, • the position number, which you use to select a position, •...
  • Page 196 Positioning IP 240 Entering the position numbers and position values in the data block The area beginning with DW 60 is reserved for position numbers and position values. The number of positions determines the length of the data block ( Section 10.23.1). If you need more than 65 positions, then you also need more than 256 data words in the DB.
  • Page 197 IP 240 Positioning The position number assigned to a position need not be identical to the number of the position entry. It is more practical, however, for the two to be identical, particularly when you want to change a position value with control FB 168 after configuring ( Section 10.18.1), as the number of the position entry, not the position number itself, must be specified in the control FB.
  • Page 198 Positioning IP 240 When the actual value is within a range, the associated status bit BEE1, BEE2 or BEE3 is set to zero. Changes in the values of these bits can trigger the following responses from the IP during approach to a position: Table 10-13.
  • Page 199 IP 240 Positioning Transferring the distance values with the configuring FB The distance values are initially transferred to the IP 240 when you configure the channel. Before invoking FB 167, you must enter the distance values in the data block. The distance value in data words 50 and 51 is for range BEE1, the distance value in data words 52 and 53 for range BEE2, and the distance value in data words 54 and 55 for range BEE3.
  • Page 200 Positioning IP 240 Zero mark monitoring Zero mark monitoring is used to detect spurious or missing pulses, and is possible only when • the number of encoder pulses between two zero marks (Z signals) is divisible by 4 or 5 without a remainder, •...
  • Page 201 IP 240 Positioning 10.10 Initializing the Parameters for Interrupt Generation (PRA1, PRA2, ABIT) The following status bits have interrupt capability, and can trigger an interrupt on the S5 CPU when they go to ”1” or ”0”. The associated interrupt bit is also set in the interrupt request bytes. Table 10-14.
  • Page 202 Positioning IP 240 When using an S5-150U or S5-155U (150 mode), note that the ABIT parameter must also be initialized. In these programmable controllers, an interrupt service OB is invoked at the next block boundary when the associated bit in PY 0 (I/O byte 0) changes its signal state. By initializing the ABIT parameter accordingly, you can indicate whether the interrupt service OB is to be invoked every time the signal state of the interrupt bit changes, or only when the bit goes from ”0”...
  • Page 203 IP 240 Positioning Table 10-15. Contents of Data Words 8 to 10 Data byte Description DL 8 Error no. 3 DR 8 Extension to error no. 3 DL 9 Error no. 2 DR 9 Extension to error no. 2 DL 10 Error no.
  • Page 204 Positioning IP 240 10.13 Methods of Synchronization Positioning is possible with the IP 240 only when the actual value has been synchronized. Three methods of synchronization are available for this purpose: • Reference point approach A reference point approach synchronizes the actual value to a fixed point in the traversing range.
  • Page 205 IP 240 Positioning Positive direction of travel HASY control Acquiring of the preliminary contact signal by the module firmware IN signal Z pulse Status bit SYNC Counting pulses Reference point Actual value when ..NVER=0 NVER=20 .
  • Page 206 Positioning IP 240 If you configured the channel with DAV=2 (the IP controls the direction of travel during positioning) and want to pass control of the channel's outputs to the module firmware (HAND = 0) during reference point approach, you must specify the direction of travel for reference point approach via DA1S and DA2S.
  • Page 207 IP 240 Positioning b) If the IP outputs are to be controlled by the module firmware (HAND=0), they can be enabled immediately (FREI=1). If the IP 240 controls the direction of travel during positioning (DAV=2), you must also set control bit DA1S or DA2S for reference point approach to specify which input is to be set. AMSK ZYSY SOSY...
  • Page 208 Positioning IP 240 Switching the IP outputs during reference point approach (HAND=0) The switching performance of the IP outputs specified when the channel was configured is taken into account during reference point approach. a) DAV=0 (switch outputs separately) After the outputs have been enabled (FREI=1), IP output D1 is set. When the preliminary contact signal is reached (positive edge at the IN input), output D1 is reset and output D2 set.
  • Page 209 IP 240 Positioning c) DAV=2 After the outputs have been enabled, the IP output specified by setting control bit DA1S or DA2S is set. The output is reset when the reference point is reached. Positive direction of travel Negative direction of travel Control bit HASY Control bit...
  • Page 210 Positioning IP 240 Status of range bits BEE1, BEE2 and BEE3 during reference point approach When reference point approach is selected, all three range bits (BEE1, BEE2 and BEE3) are set to ”1”. Bit BEE1 is set to ”0” when the preliminary contact is reached. It remains at ”0” until the preliminary contact is exited and the status area on the IP 240 has been read at least once.
  • Page 211 IP 240 Positioning Interrupting a reference point approach You can interrupt a reference point approach by transferring • control bit HASY = 0 or • control bit FREI = 0 to the IP 240. When the reference point approach is interrupted with HASY=0 and FREI=1, the IP outputs are disabled only when they are are under IP 240 module firmware control during reference point approach (HAND=0).
  • Page 212 Positioning IP 240 The new position number can be transferred to the IP 240 together with SOSY=1. Refer to Section 10.14.1 for information on how to select a position number. If there is to be no software-controlled synchronization, you must set SOSY to ”0” prior to the next transfer of the control bits.
  • Page 213 IP 240 Positioning 10.13.3 Synchronization with an External Control Signal When synchronization with an external control signal, referred to from here on as ”cyclic synchronization”, is used, the IP 240 evaluates the edge change at the IN input. On a positive signal edge (signal change from 0 to 1) at this input, the actual value is set to the value of the zero offset and the position last selected reactivated.
  • Page 214 Positioning IP 240 Actual Actual Transfer The actual The actual value value value 3000 is value 4000 is ZYSY=1 stored as stored as NVER NVER final value final value Sample actual value 1000 2000 3000 1000 2000 3000 4000 actual value 3000 4000...
  • Page 215 IP 240 Positioning Warning Cyclic synchronization is also allowed when the IP outputs are set. The position transferred goes into force immediately on an IN signal. The states of the outputs may thus change instantaneously, causing a short-term overlap. A bounce-free switching element must be used to generate the IN signal. 10.13.4 Transferring Control Bits to Select a Synchronization Mode Note the following when initializing the control bits to select a synchronization mode: •...
  • Page 216 Positioning IP 240 10.14 Selecting a Position Positioning is started by selecting a position. The IP 240 uses the position value for the position selected as the new setpoint, and computes the locations of ranges BEE1 to 3 from the specified distance values.
  • Page 217 IP 240 Positioning Note The IP 240 accepts the specified position number only when control bit HAND is not set. In addition, • status bit SYNC must be set and the specified channel's outputs disabled or • SOSY=1 or ZYSY=1 (if ZYSY=1 for the first time) must be transferred together with the position number.
  • Page 218 Positioning IP 240 If it is necessary to disable the IP outputs, you can do so by transferring FREI=0 and, at the same time, specify the new position number (thus combining steps 2 and 3). If it is not necessary to disable the IP outputs, you can omit step 2 and transfer the new position number together with control bits FREI=1 and HAND=0 (thus combining steps 3 and 4).
  • Page 219 IP 240 Positioning Table 10-18. Contents of the DB and the Transfer Buffer for Writing Position 0 Data byte Offset Description Data in transfer block buffer Position value, DL 37 in binary DR 37 A negative value is in two's DL 38 complement representation SE=Sign extension...
  • Page 220 Positioning IP 240 10.15 Controlling the Digital Outputs During Positioning You can use IP outputs D1 and D2 to • change the traversing speed or • control the direction of travel. If there are two speeds and two directions of travel, you require two additional PLC digital outputs to implement the additional function.
  • Page 221 IP 240 Positioning Controlling the IP outputs via the S5 CPU (HAND=1) You can define the states which the IP outputs are to assume via the S5 CPU using control bits DA1S and DA2S. DAnS=1 Output Dn is to be set. DAnS=0 Output Dn is to be reset.
  • Page 222 Positioning IP 240 Table 10-19. Contents of the DB and the Transfer Buffer for Transferring the Control Bits Data byte Offset Description Data in transfer block buffer Control bits DL 36 AMSK ZYSY SOSY HASY DA2S DA1S HAND FREI DR 36 .
  • Page 223 IP 240 Positioning 10.16 Reading and Evaluating the IP Status Information This includes: • the current (feedback) position number • the status bits • the current actual value • the stored final value (is entered only in cyclic synchronization mode) Table 10-20.
  • Page 224 Positioning IP 240 Reading the status information from the IP 240 with control FB 168 in direct data interchange You must initialize FB 168 as follows to read You must specify the following job numbers the status info: to read the status info: •...
  • Page 225 IP 240 Positioning Status bit Bit is ”1” Bit is ”0” RICH Actual value not yet synchronized or no pos. no. active (direction) - The target position must be ap- - The target position must be ap- proached from a negative direction proached from a positive direction (descending actual value).
  • Page 226 Positioning IP 240 Status bit Bit is ”1” Bit is ”0” RIUM Actual value exited range BEE2. Rever- sal of direction of travel is possible. (Reversal of direction) A new position number was trans- ferred to the IP 240. The relevant output is set. Relevant output is reset.
  • Page 227 IP 240 Positioning When they have been read, status bits NPUE, UEBL, MESE and UEBS are reset on the IP 240, i.e. these bits can be read out only once. The actual value The actual value is updated on the IP 240 in every firmware cycle. Depending on how the channel was configured, the actual value is made available in either binary or BCD code.
  • Page 228 Positioning IP 240 Table 10-21. Contents of the DB and the Transfer Buffer on Reading the Interrupt Request Bytes Data byte Offset Description in data in transfer block buffer DL 20 Interrupt request bytes for channel 1 DR 20 RICH DL 21 Interrupt request bytes for channel 2...
  • Page 229 IP 240 Positioning Examples for interrupt bits BE1 to BE3, ZBV and RIU Without backlash Rotary axis compensation Target BEE1 BEE2 BEE3 BEE3 BEE2 BEE1 position Linear axis Status bits: RIUM ZBEV BEE3 BEE2 BEE1 Negative direction BEE1 BEE2 BEE3 ZBEV RIUM Positive direction...
  • Page 230 Positioning IP 240 Interrupt bit Bit is ”1” The IP 240 detected a wirebreak in a symmetrical encoder. (Wirebreak) The IP 240 detected a zero mark error. (Zero mark monitoring) The actual value has exited the valid actual value range and entered the overrange.
  • Page 231 IP 240 Positioning The modified data go into force as soon as they are transferred. The IP 240 updates the status bits and generates any pending interrupts. However, the IP outputs are not set. To set the outputs, you must retransfer the position number. 10.18.1 Modifying the Position Value When you want to change a position value for position 1 to 254, you must specify the new position value and the associated position number.
  • Page 232 Positioning IP 240 If you use FB 168 to write the new position values, you must specify the entry to be transferred in the data block when you initialize the FKT parameter. Based on this information, the FB checks the length of the DB and computes the number of data words to be transferred. You can also specify whether you want to transfer only one entry or two continuous DB entries to the IP 240.
  • Page 233 IP 240 Positioning 10.18.2 Changing the Distance Values for Ranges BEE1 to BEE3 Table 10-23. Contents of the Data Block and the Transfer Buffer for Changing Distance Values Data byte Offset Description in data in transfer block buffer DL 50 .
  • Page 234 Positioning IP 240 Transferring modified distance values for the switching and signalling ranges with control FB 168 in direct data interchange You must first enter the new distance values You must specify the following job numbers in the data block. to transfer the new distance values: Initialize the FB as follows: •...
  • Page 235 IP 240 Positioning Table 10-24. Contents of the Data Block and the Transfer Buffer for Changing the Zero Offset Data byte Offset Description in data in transfer block buffer DL 45 ..Control bit ADD DR 45 Zero offset DL 46...
  • Page 236 Positioning IP 240 10.19 Interrupting Positioning and Skipping of a Position Positioning is interrupted when • control bit FREI=0 is transferred. In this case, the outputs are disabled but the old position number is retained. If the actual value changes (e.g. due to transfer of a zero offset), the status bits are matched to this position number and any pending interrupts generated in dependence on the actual value.
  • Page 237 IP 240 Positioning If the channel was structured for backlash compensation and the actual position is above the target position (RICH=1), output D2 is automatically set if the IP outputs have been enabled. When the BEE2 range is exited, the IP output must be reset via the S5 CPU by transferring control bit FREI=0 to the IP 240.
  • Page 238 Positioning IP 240 10.21 Positioning with the IP 240 The flowchart below illustrates the functional sequence for positioning with the IP 240. In the examples, no checks are made for errors such as skipping of a position or wirebreak. 10.21.1 Positioning with the IP Controlling the Speed START Set control bit FREI to ”0”...
  • Page 239 IP 240 Positioning 10.21.2 Positioning with the IP Controlling the Direction START Set control bit FREI to ”0” Write control bits and position number Read actual value and status bits BEE2=”0”? RICH=”0”? Set control bits FREI, HAND and DA2S to ”1” Write control bits (start negative direction of travel) Set control bit FREI to ”1”...
  • Page 240 Positioning IP 240 10.22 Error Processing Following Positioning Control Errors occurring during transfer of data to the IP are flagged • in the PAFE byte when FB 168 is used and • in the IP's status register when using direct data interchange ( Chapter 11). Warning The PAFE byte or IP 240 status register must be evaluated after every data inter- change.
  • Page 241 IP 240 Positioning 10.23 Data Block Contents and Initializing the Standard Function Blocks 10.23.1 The Data Block Creating the data block The standard function blocks (configuring FB and control FB) use a data block (DB) to interchange data with the IP 240. You must create this data block and enter the required data prior to the first FB call.
  • Page 242 Positioning IP 240 Contents of the data block Table 10-27. Contents of the Data Block (DW 0 to DW 821) DW 0 DW 32 to Final value DW 1 to 3 Machine-readable product designation of the module DW 34 DW 4 to 6 Module firmware version DW 35 Control bits and position...
  • Page 243 IP 240 Positioning Contents of the data words You must set the unassigned positions of the data words you want to transfer to the IP 240 to ”0”. Function number for indirect initialization of control FB 168 Data FKT: byte KY x,y DL 19 FKT x...
  • Page 244 Positioning IP 240 ID for the configured mode and data block number Data byte DL 23 DB no. DR 23 Following error-free configuring of the channel, a bit combination identifying the current mode is entered in DL 23. DL 23 = 04 The channel was configured for ”positioning”...
  • Page 245 IP 240 Positioning Status bits Data byte DL 29 RIUM ZBEV UEBS DRBR NPUE UEBL DR 29 MESE BEE3 BEE2 BEE1 RICH SYNC RIUM = 1 Range BEE2 was exited (reversal of direction possible). ZBEV = 1 The target range (BEE3) was exited. UEBS = 1 The stored final position was overwritten without being read out from the IP 240.
  • Page 246 Positioning IP 240 Final value Binary representation BCD representation Data byte DL 32 DR 32 DL 33 DR 33 Negative values are represented The high-order nibble (SG) is as two's complement. ”1111” for a negative number. SE=Signal extension Control bits and position number for position 1 to 254 Data byte DL 35...
  • Page 247 IP 240 Positioning Data for position 0 Position value for position 0 Binary representation BCD representation Data byte DL 37 DR 37 DL 38 DR 38 Negative values are represented ”1111” must be entered in the as two's complement. high-order nibble (SG) for a SE=Sign extension negative number.
  • Page 248 Positioning IP 240 Distance value for range BEE3 Data byte DL43 DR43 Control bit for the distance values Data byte DL44 GAUE DR44 GAUE = 1 Use specified distance values. Use distance values stored on the IP. Zero offset Control bit for the zero offset Data byte DR 45...
  • Page 249 IP 240 Positioning Final position of the rotary axis Binary representation BCD representation Data byte DL 48 DR 48 DL 49 DR 49 Permissible values: 1 to+9,999,999 Distance values for ranges BEE1 to 3 for positions 1 to 254 Data words DW 50 and DW 51 are for the distance value for BEE1. Data words DW 52 and DW 53 are for the distance value for BEE2.
  • Page 250 Positioning IP 240 Position number and position value for positions 1 to 254 In the tables below, the first word for a position entry is always identified by variable n. The first position entry begins at data word DW 60. position entry : DW 60 to DW 62...
  • Page 251 IP 240 Positioning 10.23.2 The Configuring Function Block FB 167 (STRU.POS) Configures and initializes the IP 240 for ”positioning” mode Functional description The configuring FB first checks the input parameters and the length of the data block to be used for data interchange with the IP.
  • Page 252 Positioning IP 240 Table 10-28. Parameters for Configuring FB 167 Parameter Data NAME Description type type BGAD Module start address KANR Channel number DBNR KF/KY Data block number Resolution of encoder pulses Zero mark monitoring Number format PRA1 Allocation of interrupts PRA2 Allocation of interrupts RUND...
  • Page 253 IP 240 Positioning BCD : KY x,y Number format x /y=0 Binary x /y=1 x determines the following values: • Position values for positions 1 to 254 • Distance values for positions 1 to 254 • Final position of the rotary axis y determines the following values: •...
  • Page 254 Positioning IP 240 PAFE : QB QB or FY (0 to 239) for flagging errors ( Section 6.4) BER : KF Addressing in P area Addressing in Q area ABIT : KYx,y x=0 to 255 x>0 The interrupt service OB is invoked on every signal change of the interrupt bit The interrupt service OB is invoked only when the interrupt bit goes from 0 to 1...
  • Page 255 IP 240 Positioning Technical Specifications Block number : 167 Block name : STRU. POS Call length/ Library number Processing time Block length S5-115U P71200-S 5167-D-2 14 words/ 941-7UA... approx. 95 to 990 1159 words 942-7UA... approx. 48 to 565 943-7UA... approx.
  • Page 256 Positioning IP 240 10.23.3 The Control Function Block FB 168 (STEU.POS) Control function block for ”positioning” mode Functional Description The control function block first checks to make sure that the DB has the correct identifier in DL 23 and that the channel was configured for ”positioning” mode. Then, depending on the parame- ters with which the FB was initialized, specific data areas are forwarded from the data block to the IP or read out from the IP and updated in the data block.
  • Page 257 IP 240 Positioning Invoking the control function block The control FB is normally invoked in the cyclic program and in the interrupt service OBs. LAD/CSF FB 168 : JU FB 168 NAME : STEU.POS DBNR : KF/KY DBNR : KY PAFE PAFE : QB Table 10-29.
  • Page 258 Positioning IP 240 : KY x,y Format Description Take function number (FKT) from DW 19. Read actual value, feedback position number, status bits and final value. Write control bits. Write control bits to disable the IP outputs. The FB sets control bit FREI (D36/8) to ”0”. 1 to Write control bits and position number.
  • Page 259 IP 240 Positioning Technical Specifications Block number : 168 Block name : STEU. Call length/ Processing time Library number Block length Function 41/42 S5-115U P71200-S 5168-D-2 5 words/ 941-7UA... approx. 21 22 22.5 21 28.5 25.5 25 ms 830 words 942-7UA...
  • Page 260 Positioning IP 240 10.24 Sample Program for Processing Data Words with a Data Word Number Exceeding 255 If a data block exceeds a length of 256 data words, those data words with a data word number exceeding 255 must be processed using supplementary STEP 5 operations (system operations). The sample programs below are intended to help you work with these data words.
  • Page 261 IP 240 Positioning ************************** SAMPLE PROGRAM FOR S5-115U ************************** NAME :L/T DWX :DBNR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :DWNR I/Q/D/B/T/C: I BI/BY/W/D: W :L/T I/Q/D/B/T/C: I BI/BY/W/D: BI :DWN I/Q/D/B/T/C: I BI/BY/W/D: W :DWN1 I/Q/D/B/T/C: I BI/BY/W/D: W :DWN2 I/Q/D/B/T/C: I BI/BY/W/D: W 0017 KH E400 BASE ADDRESS FOR MODULE...
  • Page 262 Positioning IP 240 *********************************** SAMPLE PROGRAM FOR S5-135U AND 150U *********************************** ADDRESS REQUIRED IN PROGRAM DEPENDS ON PLC TYPE AND DATA BLOCK TYPE: S5-135U - DB - DF00 HEX - DX - DE00 HEX S5-150U - DB - DBBE HEX ====================================================== NAME :L/T DWX :DBNR...
  • Page 263 IP 240 Positioning ************************** SAMPLE PROGRAM FOR S5-155U ************************** THE ADDRESS REQUIRED IN THE PROGRAM DEPENDS ON THE DATA BLOCK TYPE: S5-155U - DB - EEC00 HEX - DX - EEE00 HEX ============================================== NAME :L/T DWX :DBNR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :DWNR I/Q/D/B/T/C: I BI/BY/W/D: W...
  • Page 264 Positioning IP 240 10.25 Example: Removing Parts from a Die-Casting Machine Finished parts are to be taken from a die-casting machine and deposited at various positions. This example concentrates on positioning of one of the three axes. When the setpoint is reached, an interrupt is generated, thus enabling a gripper. The traversing speed (rapid traverse or creep speed) is set directly via the IP's digital outputs.
  • Page 265 IP 240 Positioning Flags, inputs, outputs, timers and DBs OPERAND SYMBOL COMMENTARY F 0.0 RLO0 FLAG FOR "0" SIGNAL F 0.1 RLO1 FLAG FOR "1" SIGNAL FY 60 NPOS NUMBER OF NEXT POSITION TO BE APPROACHED FY 61 RESPONSE RESPONSE ON REACHING POSITION F 61.0 RESP01 OPEN GRIPPER...
  • Page 266 Positioning IP 240 OPERAND SYMBOL COMMENTARY FY 65 ERROR REASON FOR SETTING GROUP ERROR FLAG (F 64.7) F 65.0 ERR00 REF. POINT APPROACH TERM. WITHOUT SYNC F 65.1 ERR01 NOT ENOUGH DISTANCE BETW. ACTVAL AND SETPOINT F 65.2 ERR02 TARGET RANGE NOT REACHED F 65.3 ERR03 TARGET RANGE EXITED (ZBV)
  • Page 267 IP 240 Positioning OPERAND SYMBOL COMMENTARY FY 200 PAFE CONTENTS SEE INSTR. MAN. SEC. 6.4 POSTIMER WATCHDOG TIMER FOR POSITIONING STOPTIMER TIMER FOR MOTOR DECELERATION REFTIMER DELAY TIME FOR ZERO MARK AFTER PRELIM. CONTACT STRTCLK CLOCK PULSE FOR ACOUSTIC LIMIT SWITCH STOPCLK CLOCK PULSE FOR ACOUSTIC LIMIT SWITCH Q 4.0...
  • Page 268 Positioning IP 240 Functional sequence: Restart routine (FB 20) START Save scratch flags/ system data Configure IP 240: - Channel 1 for positioning mode Reload scratch flags/ system data Cyclic program (FB 30) Compute reference point Approach home ”Start”? position Machining Approach pickup position, cycle...
  • Page 269 IP 240 Positioning Cyclic program for x axis (FB 30) START Read actual value and status - Reset outputs Main - Reset bits switch - Reset program flags - Reset IP outputs Refe- rence point Approach reference point approach exe- (FB 31) cuted? Ref.
  • Page 270 Positioning IP 240 Reference point approach FB 31 START Reference Negative point approach limit switch in progress? reached? Stop negative direction of travel Reset IP outputs Start timer for motor deceleration Preselect negative direction Motor deceleration time expired? Select reference point approach on IP Start positive direction of travel Start watchdog or delay timer for encoder's zero mark signal Delay...
  • Page 271 IP 240 Positioning Select next position (FB 32) START Last response Last response open gripper? close gripper? - Prepare for ”close gripper” - Prepare for ”open gripper” - Write position number of pickup - Write next eject position to transfer position to transfer flag flag - Increment pointer for next eject...
  • Page 272 Positioning IP 240 Select and approach position (FB 33) START Positioning in progress (POSACTIV)? Position reached? New pos. no. feedback - Reset program status pos. no.? (POSACTIV) - Reset direction outputs - Start watchdog timer for positioning procedure - Reset fault flags from last Watchdog positioning procedure timers expired?
  • Page 273 IP 240 Positioning Interrupt service routine for x axis (FB 34) START Save scratch flags/ system data Cut-off range entered? Start watchdog timer for motor deceleration Target range entered? - Stop watchdog timers - Enable responses Target range exited? Flag error System fault: wire- break/zero mark...
  • Page 274 Positioning IP 240 DB100 TRAVERSING DATA ################################################## DATA BLOCK WITH TRAVERSING DATA FOR CHANNEL 1 # ################################################## 0 - ERROR FLAGGED IN RESTART ROUTINE BY FB167 (DB128/DW10) 1 - ERROR FLAGGED IN RESTART ROUTINE BY FB167 (DB128/DW13) DR 11 - POSITION NUMBER FOR HOME POSITION DL 11 - POSITION DR 12 -...
  • Page 275 IP 240 Positioning DB128 KH = 0000; KS =' MACHINE-READABLE PRODUCT DESIGNATION FIRMWARE VERSION KS =' HARDWARE VERSION KH = 0000; ERROR NO. 1 FROM IP KH = 0000; ERROR NO. 2 FROM IP KH = 0000; ERROR NO. 3 FROM IP KH = 0000;...
  • Page 276 Positioning IP 240 KH = 0004; 4TH POS. NO. KH = 0025; ] 4TH VALUE KH = 0000; KH = 0005; 5TH POS. NO. KH = 0000; ] 5TH VALUE KH = 0000; KH = 0006; 6TH POS. NO. KH = 0004; ] 6TH VALUE KH = 0000;...
  • Page 277 IP 240 Positioning FB 20 NETWORK 1 0000 GENERATE LOG. "0" AND "1" #################################### # RESTART PROGRAM CONFIGURE AXIS 1 # #################################### NAME :ANLAUF 0005 -RLO0 0006 -RLO0 0007 -RLO1 0008 -RLO1 0009 :*** 0.0 = RLO0 FLAG FOR "0" SIGNAL 0.1 = RLO1 FLAG FOR "1"...
  • Page 278 Positioning IP 240 = NPOS NO. OF NEXT POS. TO BE APPROACHED = RESPONSE RESPONSE WHEN POSITION IS REACHED = CNTL CONTROL BITS (DL36) = STATBITS STATUS BITS (DR29) = STATUS STATUS FROM POSITIONING PROG. (FB10) = ERROR CAUSE OF GROUP ERROR (F64.7) = FBPOS FEEDBACK POSITION NUMBER...
  • Page 279 IP 240 Positioning NETWORK 5 0051 RELOAD SCRATCH FLAGS / RS DATA 0051 ----------------------------- 0052 RELOAD FLAGS 240-255 0053 FW 240 0054 REQUIRED ONLY AS IN 0055 FW 242 NETWORK 2 (SAVE SCRATCH 0056 FLAGS / RS DATA) 0057 FW 244 0058 0059 FW 246...
  • Page 280 Positioning IP 240 FB 30 NETWORK 1 0000 READ ACTUAL VALUE FROM IP 240 ############################# # CYCLIC PROGRAM FOR X AXIS # ############################# NAME :X-ACHSE 0005 DB 128 -DBCH1 0006 0007 FB 168 ------------------------------ 0008 NAME :STEU.POS 0009 DBNR : KF +0 000A FKT KY 1,0...
  • Page 281 IP 240 Positioning 32.0 = MAINSW MAIN SWITCH: ENABLE FOR CONTROL SYSTEM 0.0 = RLO0 FLAG FOR "0" SIGNAL 4.0 = POSDIR OUTPUT FOR DIRECTION CONTROL 4.1 = NEGDIR OUTPUT FOR DIRECTION CONTROL 4.2 = HOOTER ACOUSTIC FAULT SIGNAL 5.0 = OPENGR OUTPUT 'OPEN GRIPPER' 5.1 = CLOSGR OUTPUT 'CLOSE GRIPPER'...
  • Page 282 Positioning IP 240 64.2 = REFACTIV REF.POINT APPROACH IN PROGRESS 64.0 = POSACTIV POSITIONING IN PROGRESS 5.0 = OPENGR OPEN GRIPPER OUTPUT 5.1 = CLOSGR CLOSE GRIPPER OUTPUT 64.5 = MACHCYC MACHINING CYCLE IN PROGRESS 32.1 = START START OF POSITIONING PROGRAM = HOMEPOS POS.NO.
  • Page 283 IP 240 Positioning 0082 0083 33.2 -GRUP LIMIT SWITCH MONITORING 0084 -CLOSGR GRIPPER 0085 0086 33.3 -GRDOWN 0087 -OPENGR 0088 -CLOSGR ------------------------ 0089 008A 64.6 -AUXF01 SECONDS CLOCK PULSE FOR 008B -STOPCLK ACOUSTIC LIMIT SW. SIGNAL 008C KT 050.0 008E -STRTCLK 008F -STRTCLK...
  • Page 284 Positioning IP 240 FB 31 NETWORK 1 0000 ############################ # REFERENCE POINT APPROACH # ############################ NAME :REFFAHRT 0005 DB 128 -DBCH1 0006 0007 64.2 -REFACTIV 0008 =VOR1 0009 ------------------------- 000A FB 168 RESET OUTPUTS 000B NAME :STEU.POS 000C DBNR : KF +0 000D FKT KY 20,1...
  • Page 285 IP 240 Positioning 0042 FB 168 0043 NAME :STEU.POS 0044 DBNR : KF +0 0045 FKT KY 20,0 TRANSFER CONTROL BITS 0046 PAFE : FY 200 -PAFE 0047 FY 200 -PAFE 0048 KH 0000 004A :><F 004B 65.7 -ERR07 004C -------------------------------- 004D KH 0000...
  • Page 286 Positioning IP 240 FB 32 NETWORK 1 0000 ################################################ # SELECTING THE NEXT POSITION TO BE APPROACHED # ################################################ NAME :AUSWAHL 0005 61.0 -RESP01 0006 =VOR2 0007 61.1 -RESP02 0008 =VOR1 0009 :BEU 000A VOR1 :S 61.0 -RESP01 000B 61.1 -RESP02 000C -EJECTPOS...
  • Page 287 IP 240 Positioning FB 33 NETWORK 1 0000 ################################################ # TRANSFER POSITION NUMBERS TO IP, POSITIONING # ################################################ NAME :POS/ANW 0005 DB 128 -DBCH1 OPEN IP DATA BLOCK 0006 64.0 -POSACTIV 0007 0008 -NPOS 0009 -FBPOS 000A :!=F 000B =NTW2 ------------------------- 000C -RLO1...
  • Page 288 Positioning IP 240 0041 0042 63.3 -BEE2 0043 63.1 -RICH 0044 -NEGPOS 0045 =NTW2 ------------------------- 0046 0047 -RLO0 0048 -POSTIMER STOP TIMER 0049 -STOPTIMER 004A 64.0 -POSACTIV PROGRAM STATUS 004B ------------------------- 004C 63.4 -BEE3 WHEN ACT.VAL. BETWEEN 004D 64.7 -FAULT CUT-OFF &...
  • Page 289 IP 240 Positioning NETWORK 2 0061 ERROR MONITORING 0061 -POSTIMER WHEN TIME EXCEEDED 0062 65.4 -ERR04 0063 64.7 -FAULT 0064 0065 -STOPTIMER WHEN TIMER RAN DOWN 0066 65.2 -ERR02 BEF. INT.BIT BE3 WAS SET 0067 64.7 -FAULT 0068 0069 = POSTIMER WATCHDOG TIMER FOR POSITIONING 65.4 = ERR04 PERM.TIME FOR POSITIONING EXCEEDED...
  • Page 290 Positioning IP 240 FB 34 NETWORK 1 0000 ######################################## # INTERRUPT SERVICE ROUTINE FOR X AXIS # ######################################## NAME :ALARM/K1 0005 DB 100 -DATA1 ------------------------- 0006 FW 240 SAVE SCRATCH FLAGS 0007 0008 FW 242 REQUIRED ONLY FOR 115U, 0009 155U (IN 155U MODE) AND 000A FW 244...
  • Page 291 IP 240 Positioning NETWORK 3 0031 CUT-OFF RANGE REACHED 0031 69.3 -BE2 0032 =NTW3 0033 -RLO1 0034 KT 100.0 START WATCHDOG TIMER (1 SEC) 0036 -STOPTIMER 0037 NTW3 :*** 69.3 = BE2 IR BEE2 ENTERED 0.1 = RLO1 FLAG FOR "1" SIGNAL = STOPTIMER TIMER FOR MOTOR DECELERATION NETWORK 4...
  • Page 292 Positioning IP 240 NETWORK 6 0051 HARDWARE FAULTS 0051 68.0 -UEB 0052 68.1 -NPU 0053 68.2 -DRB 0054 =NTW6 0055 65.5 -ERR05 0056 64.7 -FAULT 0057 -POSDIR 0058 -NEGDIR 0059 NTW6 :*** 68.0 = UEB IR COUNT IN OVERRANGE 68.1 = NPU IR ZERO MARK ERROR 68.2 = DRB IR WIREBREAK/SHORT-CIRCUIT...
  • Page 293 IP 240 Positioning FB 167 NETWORK 1 0000 NAME :STRU.POS :BGAD I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :KANR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :DBNR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :AFL I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :IMP I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KF :BCD I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KY :PRA1 I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KM...
  • Page 294 Positioning IP 240 OB 2 NETWORK 1 0000 INTERRUPT SERVICE ROUTINE AXIS 1 ############################################## # ORGANIZATION BLOCK FOR INTERRUPT SERVICING # ############################################## 0000 0001 0002 0003 NAME :ALARM/K1 0004 0005 OB 20 NETWORK 1 0000 ############################################## # ORGANIZATION BLOCK FOR MANUAL COLD RESTART # ############################################## FOR THE 115U =>...
  • Page 295 System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning Direct Data Interchange with the IP 240 11.1 Status and Job Request Register (Offset 15) ..... 11 - 2 11.1.1 Status Register .
  • Page 296 Figures 11-1. Flowchart for ”Read data from the IP 240” ......11- 5 11-2.
  • Page 297 IP 240 Direct Data Interchange with the IP 240 Direct Data Interchange with the IP 240 For time-critical applications, it may be necessary to exchange data directly with the IP 240 without using the control FBs. This section provides information on •...
  • Page 298 Direct Data Interchange with the IP 240 IP 240 In the following, it has been assumed that the channel has been configured with standard FB 167 for positioning mode, with FB 169 for position decoding mode, or with FB 171 for counting mode. 11.1 Status and Job Request Register (Offset 15) The IP 240's status register can be read out and its job request register written to under this...
  • Page 299 IP 240 Direct Data Interchange with the IP 240 Table 11-1. Contents of the Status Register Abbr. Meaning when bit is ”1” Job terminated, AFRT The job request was serviced without error. Job request acknowledged, AERK The IP 240 acknowledged recogniton of a job request (can be evaluated following RESET only).
  • Page 300 Direct Data Interchange with the IP 240 IP 240 11.1.2 Job Request Register The S5 CPU enters the job number in the job request register, thus telling the IP 240 which job it is to execute. Table 11-2. Contents of the Job Request Register Job number Functional description for mode Chan.
  • Page 301 IP 240 Direct Data Interchange with the IP 240 11.2 Data Transfer from the IP 240 to the S5 CPU The S5 CPU can request data from the IP 240. To make this possible, you must enter the appropri- ate job number in the IP's job request register. The IP 240 sets the DFRT bit in the status register when the requested data are available in the transfer buffer.
  • Page 302 Direct Data Interchange with the IP 240 IP 240 Write new job number Read status register Data not yet available in transfer DFRT=0? buffer? Error detected? ERR=1? Read out data Write job number 40 Reset communication. Read status register AFRT=0? Job number for reading error Write job number 01 codes...
  • Page 303 IP 240 Direct Data Interchange with the IP 240 11.3 Data Transfer from the S5 CPU to the IP 240 The S5 CPU can forward new data to the IP 240. To do so, you must first transfer the new data, then you must enter the appropriate job numbers in the IP's job request register.
  • Page 304 Direct Data Interchange with the IP 240 IP 240 The flowchart shown below illustrates the communication procedure for ”Write data to the IP 240” Start Disable interrupts and start 200 µs delay timer Waiting time expired? Read status register Old job terminated? AFRT=1? DFRT=0? Write job number 40...
  • Page 305 IP 240 Direct Data Interchange with the IP 240 Read status register Data not yet fetched from trans- DFRT=0? fer buffer? Error detected? ERR=1? Write job number 40 Reset communication. Read status register AFRT=0? Job number for reading error Write job number 01 codes.
  • Page 306 Direct Data Interchange with the IP 240 IP 240 11.4 Contents of the Transfer Buffer 11.4.1 Position Decoding Mode Read actual value and status area When you have transferred job number 1B (channel 1) or 2B (channel 2) to the IP 240's job request register, the IP 240 makes the actual value and the status area available in the transfer buffer.
  • Page 307 IP 240 Direct Data Interchange with the IP 240 SYNC =1 Reference point approach was terminated with synchronization DRBR =1 Wirebreak/short-circuit in lines for encoder for symmetrical pulse trains NPUE =1 Change in number of pulses between two zero mark signals REFn =1 Actual value lies within track n (including track limits) Actual value not within track n...
  • Page 308 Direct Data Interchange with the IP 240 IP 240 Write initial and final track values To change the initial value and final value for a track, you must load these two values into the transfer buffer and then load the job request register with either 1n or 2n (where n=number of the track).
  • Page 309 IP 240 Direct Data Interchange with the IP 240 Write control bits To initialize control bits, you must load the new control bits into the transfer buffer and write job number 1A or 2A to the job request register. Table 11-7. Contents of the Transfer Buffer on Writing Control Bits, Position Decoding Mode Offset Description transfer...
  • Page 310 Direct Data Interchange with the IP 240 IP 240 11.4.2 Counting Mode Read actual value, final value and status area The IP 240 makes the actual value, the final value and the status area available in the transfer buffer when you transfer job number 1B (channel 1) or 2B (channel 2) to the job request register.
  • Page 311 IP 240 Direct Data Interchange with the IP 240 REF2 =1 Final value was stored UEBL =1 Actual value out of range ( - 9,999) < UEBE =1 Final value out of range ( - 9,999) < UEBS = 1 Final value overwritten without being read Actual value is negative Actual value is positive...
  • Page 312 Direct Data Interchange with the IP 240 IP 240 Write initial count To modify the initial count value, you must enter the new value in the transfer buffer and write job number 11 or 21 in the job request register. Table 11-10.
  • Page 313 IP 240 Direct Data Interchange with the IP 240 11.4.3 Reading Error Messages The IP 240 makes the error available in the transfer buffer when you transfer job number 01 the IP 240's job request register. Table 11-12. Contents of the Transfer Buffer on Reading Error Messages Offset Description transfer...
  • Page 314 Direct Data Interchange with the IP 240 IP 240 11.5 Sample Programs The following sample programs show how to program direct data interchange with the IP 240. Note that time monitoring of the loops for querying the IP status register has been omitted from the STEP 5 programs for the purpose of clarity and better readability.
  • Page 315 IP 240 Direct Data Interchange with the IP 240 M 239.4 -ERR ERROR? : JC =ERR2 JUMP TO ”READ ERROR MESSAGES” PY224 TRANSFER BCD-CODED ACTUAL VALUE FY227 PY225 FY226 PY226 FW224 FW224 AND FW226 CONTAIN THE ACTUAL VALUE PY232 TRANSFER THE SIGN OF THE ACTUAL VALUE FY222 AND THE OVERRANGE STATUS BIT KH0040...
  • Page 316 Direct Data Interchange with the IP 240 IP 240 11.5.2 Writing Data to the IP 240 The module is set to module address 160 and channel 2 is configured for position decoding mode. The limit values for the 3rd track were transferred to the IP 240 in the restart routine (OB20/21/22) and are to be modified in the cyclic program.
  • Page 317 IP 240 Direct Data Interchange with the IP 240 FY 142 TRANSFER BCD DECADES 10^3 AND 10^2 PY 161 OF THE INITIAL VAL. FOR THE 3RD TRACK FY 141 TRANSFER BCD DECADE 10^4 OF THE PY 162 INITIAL VAL. FOR THE 3RD TRACK FY 140 TRANSFER SIGN OF INITIAL VALUE PY 163...
  • Page 318 Direct Data Interchange with the IP 240 IP 240 ERR3 KH0001 LOAD JOB NUMBER FOR ”LOAD ERROR PY175 MESSAGES” AND TRANSFER JOB NO. STA5 PY175 READ STATUS REGISTER FY239 : AN F 239.2 -DFRT DATA NOT YET AVAILABLE? : JC =STA5 PW160 TRANSFER ERROR MESSAGES...
  • Page 319 System Overview Module Description and Accesories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning Direct Data Interchange with the IP 240 Response Times 12.1 Structure of a Firmware Cycle ....... . . 12 - 1 12.2 Computing the Response Time .
  • Page 320 Figures 12-1. Structure of a Firmware Cycle (Example) ....... 12 - 1 12-2.
  • Page 321 IP 240 Response Times Response Times The response time is the time between reaching of a setpoint and the IP 240's reaction. The signals from the incremental encoders or pulse encoders are acquired by counter chips. These counter chips make an internal count available which is read and evaluated in each module firmware (FW) cycle.
  • Page 322 Response Times IP 240 12.2 Computing the Response Time Using channel 1 as example, Figure 12-2 shows which FW slices must be taken into account when computing the response time. Channel 1 setpoint reached. reak reak ka1/1 kom1 ka2/1 kom2 ka1/ Cycle 1 Cycle 2...
  • Page 323 IP 240 Response Times Position decoding and positioning Counting modes mode Setpoint reached or error has occured Status bit is updated Interrupt is generated Output is set Output is reset reak reak =max. 50 µs (when ohmic load and I =50 mA) output 1) Is reset following reading of the interrupt request bytes...
  • Page 324 Response Times IP 240 12.3 Firmware Execution Times The execution time of the individual firmware slices depends on • the modes in which the channels are operated, • the configuring data and • the current actual value. The table below shows the •...
  • Page 325 IP 240 Response Times Channel 2: • Base time without configuring 45 µs 520 µs • Position decoding mode • 8 tracks used, without hysteresis 8 x t = 1840 µs In one FW cycle, 60 µs • two tracks can be entered, 2 x t •...
  • Page 326 Response Times IP 240 Positioning mode Table 12-3. Firmware Execution Times, Positioning Mode Max. execu- Description Abbrev. tion time Base time without configuring 45 µs 1050 µs Base time for positioning with linear axis and ZYSY=0 1100 µs Base time for positioning with rotary axis and ZYSY=0 1250 µs Base time for positioning with linear axis and ZYSY=1 1550 µs...
  • Page 327 System Overview Module Description and Accesories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning Direct Data Interchange with the IP 240 Response Times Encoder Signals 13.1 Signal Forms and Timing Requirements for Incremental Encoders ........13 - 1 13.1.1 Signal Forms .
  • Page 328 Figures 13-1. Signal Forms: Symmetrical Encoder Signals A/A, B/B, Z/Z and Asymmetrical Encoder Signals A*, B*, Z* ......13 - 1 13-2.
  • Page 329 IP 240 Encoder Signals Encoder Signals This section discusses the requirements for the forms and timing of the signals for the IP 240. The following encoder signals are discussed in this section: • Incremental encoder signals for position decoding, IP 252 expansion and positioning mode ( Section 13.1).
  • Page 330 Encoder Signals IP 240 13.1.2 Timing Requirements The following diagrams show the timing requirements for signals A, B and Z at the IP 240's inputs. These requirements must be observed in order to enable proper evaluation of the signals. Z signal During reference point approach and zero mark monitoring, the Z signal is evaluated while A=1 and B=1.
  • Page 331 IP 240 Encoder Signals c) Position and timing of the Z signal: A signal A signal B signal B signal Z sign. Z sign. Z sign. Z sign. Z sign. Z sign. Z sign. Z sign. : min. 50 ns : max.
  • Page 332 Encoder Signals IP 240 Timing requirements for encoders with asymmetrical signals a) Skew between tracks A and B (minimum edge spacing): A* signal B* signal b) Position and timing of the Z signal: A* signal B* signal 1) Z* signal 2) Z* signal 3) Z*...
  • Page 333 IP 240 Encoder Signals The IN signal is evaluated by the IP 240 module firmware. For this reason, acquisition of the signal edges may sometimes be deferred by one firmware cycle. The times and edge steepness given below refer to the signals present on the module. Connection of the preliminary contact signal to the IN input Direction of travel IN signal...
  • Page 334 Encoder Signals IP 240 Connecting the synchronization signal to the IN input IN signal Counting pulses 1) Pulse is not taken into account for new 3) Pulse is taken into account in stored final value. counting cycle. 4) Pulse is not taken into account in stored final value 2) Pulse is counted in next counting cycle.
  • Page 335 System Overview Module Description and Accessories Addressing Hardware Installation Operation Functional Description Position Decoding Counting IP 252 Expansion Positioning Direct Data Interchange with the IP 240 Response Times Encoder Signals Error Messages 14.1 Hardware Faults ..........14 - 1 14.2 Error Messages in Position Decoding and Counting Mode...
  • Page 336 Tables 14-1. Errors Flagged in the PAFE Byte ........14 - 1 14-2.
  • Page 337 IP 240 Error Messages Error Messages If you use standard FBs 167 to 173 for data interchange between S5 CPU and IP 240, you can ascertain whether an error or fault occurred and obtain information on where you can find a more detailed error description by evaluating the PAFE byte.
  • Page 338 Error Messages IP 240 14.2 Error Messages in Position Decoding and Counting Mode 14.2.1 Parameter and Data Errors In position decoding and counting mode, the FB parameter and the DB data are checked by the standard function blocks. If an error is detected, the error code is entered in DW 13 of the speci- fied data block.
  • Page 339 IP 240 Error Messages 14.2.2 Communications Errors Communications errors can occur when you interchange data directly with the IP 240 without using control function blocks. You must read these errors out from the IP 240's transfer buffer ( Chapter 11, ”Direct Data Interchange”). Table 14-4.
  • Page 340 Error Messages IP 240 14.4.2 Data Errors The specified data is checked by the module firmware. If standard function blocks are used for data interchange, the FB reads the error messages out from the IP 240 and enters the codes in data words 8 to 10.
  • Page 341 IP 240 Error Messages Table 14-7. Data Errors in Positioning Mode (Continued) Error code for Exten- Description sion Chan. 1 Chan. 2 Position number specified together with control bit HAND =specified position number Invalid combination of control bits FREI, HAND, DA1S and DA2S.
  • Page 342 Error Messages IP 240 Table 14-7. Data Errors in Positioning Mode (Continued) Error code for Exten- Description sion Chan. 1 Chan. 2 More than one synchronization mode selected. = 00 HASY set = 01 ZYSY set = 02 SOSY set Illegal data = 00 Zero offset out of range = 01 Zero offset exceeds final value of rotary axis...
  • Page 343 Adapter Casing (S5 Adapter) In this Chapter In this chapter, you will learn how to install modules in the adapter casing, and what you must observe when using the various S5 modules. Section Contents Page Prerequisites Installing an Adapter Casing in the S7-400 Inserting S5 Modules in an Adapter Casing Interrupt Processing Technical Specifications...
  • Page 344 The following prerequisites must be observed as regards the use of S5 modules in the S7-400: Check with your local Siemens office that the modules you want to use have been approved for implementation. Programmable S5 modules can be linked into a STEP 7 user program only with special standard function blocks.
  • Page 345 Adapter Casing (S5 Adapter) Installing an Adapter Casing in the S7-400 Introductory To install an S5 module in an S7-400, you must first install the adapter casing Remarks in the S7 rack, then set the address on the S5 module, and, finally, insert the module in the adapter casing.
  • Page 346 Adapter Casing (S5 Adapter) Inserting S5 Modules in the Adapter Casing Procedure Proceed as follows to insert an S5 module in the adapter casing: 1. Set an interrupt circuit on the module, which sets the destination CPU for interrupts (in the case of interrupt-generating modules only). Interrupt Circuit...
  • Page 347 Adapter Casing (S5 Adapter) Interrupt Processing Introductory The adapter casing converts S5 interrupts into S7 interrupt functions and in- Remarks terrupt signals. Interrupt Routing All of the S5 module’s interrupts are forwarded as (S7) process interrupts. The interrupts are routed as follows: S5 Interrupt Circuit S7 Interrupt Circuit /INT A...
  • Page 348 Adapter Casing (S5 Adapter) Technical Specifications Dimensions and Weight Maximum Current Carrying Capacity Dimensions W H D 50mm 290mm 210 The maximum power which may be drawn from the adapter (1.96 in. x 11.41 in. x casing is as follows: 8.26 in.) From the system voltage Weight...
  • Page 349 Addressing S5 Modules (Adapter Casing and IM 463-2) In this Chapter This chapter describes how to address S5 modules inserted in the adapter casing, and how to address S5 modules connected via the IM 463-2. Section Contents Page Addressing S5 Modules IP 240 EWA 4NEB 811 6120-02b...
  • Page 350 Addressing S5 Modules Addressing S5 Modules Introductory There are two ways of using an IP xxx S5 module in the S7-400: Remarks By installing it in the adapter casing in the S7 central rack By using an S5 expansion rack and connecting the S5 module via the IM 463-2 interface module in the S7 central rack and the IM 314 interface module in the S5 expansion rack.
  • Page 351 Addressing S5 Modules S5 Address Areas S5 modules in the S7-400 may be addressed in the following addressing areas: I/O area (P area) Extended I/O area (Q, IM3, IM4) Page area I/O Area A PESP signal (that is, a memory I/O select signal) is generated in the P area only when S5 modules are interfaced to the system via the adapter casing.
  • Page 352 Addressing S5 Modules Example of The CPU and an IP (an IP being an intelligent I/O module) interchange data Addressing in the via the S5 bus interface and a 2 Kbyte dual-port RAM which is divided into Page Area two “pages”. The addressing area in which the pages are located is set at the factory.
  • Page 353 The IP 240 Counter, Position Decoder and Positioning Module In this Chapter This chapter describes the counting, position decoding and positioning func- tions for the IP 240 module, lists their technical specifications and the assign- ment of the required data blocks, and provides programming examples to show you how to use the functions.
  • Page 354 IP 240 Counter, Position Decoder and Positioning Module Overview Introductory This addendum supplements Chapters 7, 8 and 10 of the Manual. It describes Remarks the standard functions of the IP 240 counter, position decoder and positioning module for the SIMATIC S7-400. The IP 240 counter, position decoder and positioning module can be con- nected via the adapter casing in a SIMATIC S7-400 programmable controller or via the IM 463-2 and IM 314 interface modules in a 185U expansion rack.
  • Page 355 IP 240 Counter, Position Decoder and Positioning Module Result: The software is installed in the following directories on the target drive: Software Directory Counting and position decoding: Standard functions: STEP7_V2\S7LIBS\IP240ZLI Examples: STEP7_V2\EXAMPLES\IP240WEX STEP7_V2\EXAMPLES\IP240ZEX Positioning: Standard functions: STEP7_V2\S7LIBS\IP240PLI Example: STEP7_V2\EXAMPLES\IP240PEX Note If you selected a directory other than STEP 7_V2 when you installed STEP 7, that directory will be entered.
  • Page 356 IP 240 Counter, Position Decoder and Positioning Module Counting Functions Function FC 171 (STRU_DOS) Introductory The call, meaning and parameter values for the FC 171 function are de- Remarks scribed below. Calling the Function Ladder Diagram LAD Statement List STL CALL FC 171 ( FC 171...
  • Page 357 IP 240 Counter, Position Decoder and Positioning Module Function FC 172 (STEU_DOS) Introductory The call, meaning and parameter values for the FC 172 function are de- Remarks scribed below. Calling the Function Ladder Diagram LAD Statement List STL CALL FC 172 ( FC 172 DBNR := FKT :=...
  • Page 358 IP 240 Counter, Position Decoder and Positioning Module Technical The technical specifications for FC 171 and FC 172 are listed below: Specifications FC 171 and FC 172 FC 171 FC 172 Block number Block name STRU_DOS STEU_DOS Version Space reserved in 2.148 bytes 1.628 bytes load memory...
  • Page 359 IP 240 Counter, Position Decoder and Positioning Module Position Decoding Functions Function FC 164 (STRU_WEG) Introductory The call, meaning and parameter values for the FC 169 function are de- Remarks scribed below. Calling the Function Ladder Diagram LAD Statement List STL CALL FC 169 ( FC 169...
  • Page 360 IP 240 Counter, Position Decoder and Positioning Module Function FC 170 (STEU_WEG) Introductory The call, meaning, and parameter values for the FC 165 function are de- Remarks scribed below. Calling the Function Ladder Diagram LAD Statement List STL CALL FC 170 ( FC 170 DBNR := FKT :=...
  • Page 361 IP 240 Counter, Position Decoder and Positioning Module Technical Speci- The technical specifications for FC 169 and FC 170 are listed below: fications for FC 169 and FC 170 FC 169 FC 170 Block number Block name STRU_WEG STEU_WEG Version Space reserved in 2.724 bytes 2.378 bytes...
  • Page 362 IP 240 Counter, Position Decoder and Positioning Module Positioning Functions Function FC 167 (STRU_POS) Introductory The call, meaning, and parameter values for the FC 167 function are descri- Remarks bed below. Calling the Function Ladder Diagram LAD Statement List STL CALL FC 167 ( FC 167...
  • Page 363 IP 240 Counter, Position Decoder and Positioning Module Parameter Values DBNR: INT = x x = Depends on the CPU used (0 is not permitted) For the values of all other parameters, please refer to the Manual (Section 10.23.2, ““Configuring Function Block””) Function FC 168 (STEU_POS) Introductory The call, meaning and parameter value for the FC 168 function are described...
  • Page 364 IP 240 Counter, Position Decoder and Positioning Module Technical Speci- The technical specifications for FC 167 and FC 168 are listed below: fications FC 167 and FC 168 FC 167 FC 168 Space in local data 24 bytes 12 bytes area Block number System functions...
  • Page 365 IP 240 Counter, Position Decoder and Positioning Module Differences between SIMATIC S7 and SIMATIC S5 Memory Locations As a rule, the following applies for SIMATIC S7: The memory locations of of the Data the data addresses are counted byte by byte. The location of an S5 data word Addresses (DW n) corresponds to the location DBW (2*n) of the S7 data word.
  • Page 366 IP 240 Counter, Position Decoder and Positioning Module Programming Example for “Counting” Mode Prerequisites, Settings, Blocks and Addresses Overview The programming example describes the standard functions for operating the IP 240 counter, position decoding and positioner module in “Counting” mode. Objectives of the programming example: The example should show the most important functions in exemplary form.
  • Page 367 IP 240 Counter, Position Decoder and Positioning Module The following interrupt settings are required in the CPU: Process interrupt: OB 40, Interrupt: I1 (S5 assignment: IA) Settings on the “Counting” mode: IP 240 required switch setting S1: No process interrupts via IB 0 S2: Interrupt circuit A, I/O area P S3: I/O address 0 S4: Sensor signals asymmetrical...
  • Page 368 IP 240 Counter, Position Decoder and Positioning Module Addresses The inputs and outputs are mapped onto memory bits at the beginning and end of OB 1. Within the test program, only the memory bits are used. Signal Memory Bit Description I 3.0 M 170.0 Start/stop counting...
  • Page 369 IP 240 Counter, Position Decoder and Positioning Module Start-up Program and Error Responses Start-up Program The start-up program is located in OB 100. When OB 100 has been pro- cessed, you can check the following entries with “Monitor/Modify variable”: DB 172.DBB 2 to DBB 7: Product code of the module DB 172.DBB 8 to DBB 13: Firmware version...
  • Page 370 IP 240 Counter, Position Decoder and Positioning Module Cyclic Program General Remarks The cyclic program is located in OB 1. At the beginning of the program, the inputs are mapped to memory bits which are then used in the rest of the program. At the end of the program, control memory bits are transferred to the outputs and displayed.
  • Page 371 IP 240 Counter, Position Decoder and Positioning Module Interrupt Program Interrupt Block The interrupt program is located in the organization block OB 40. Enabling In the start-up program, the module is structured such that when the actual Interrupts value passes through zero (PRA = W#16#0001) an interrupt is generated. Interrupt generation is initially blocked (control bit AMSK = ‘1’).
  • Page 372 IP 240 Counter, Position Decoder and Positioning Module Programming Example for “Position Decoding” Mode Prerequisites, Settings, Blocks and Addresses Overview The programming example describes the standard functions for operating the IP 240 counter, position decoder and positioning module in “Position decod- ing”...
  • Page 373 IP 240 Counter, Position Decoder and Positioning Module The following interrupt settings are required in the CPU: Process interrupt: OB 40, Interrupt I1 (S5 assignment: IA). Settings on the “Position decoding” mode: IP 240 required switch setting S1: No process interrupts via IB 0 S2: Interrupt circuit A, I/O area P S3: I/O address 0 S4: Sensor signals symmetrical...
  • Page 374 IP 240 Counter, Position Decoder and Positioning Module Addresses The inputs and outputs are mapped onto memory bits at the beginning and end of OB 1. Within the test program, only the memory bits are used. Signal Memory Bit Description I 2.0 M 180.0 Write track limits...
  • Page 375 IP 240 Counter, Position Decoder and Positioning Module Start-up Program and Error Responses Start-up Program The start-up program is in OB 100. When OB 100 has been processed, you can check the following entries with “Monitor/Modify variable”: DB 170.DBB 2 to DBB 7: Product code of the module DB 170.DBB 8 to DBB 13: Firmware version...
  • Page 376 IP 240 Counter, Position Decoder and Positioning Module Cyclic Program General Remarks The cyclic program is in OB 1. At the beginning of the program, the inputs are mapped to memory bits which are then used in the rest of the program. At the end of the program, the control memory bits are transferred to the outputs and displayed.
  • Page 377 IP 240 Counter, Position Decoder and Positioning Module Setting Digital The LEDs in the front panel allow you to observe the setting of the digital Outputs outputs D1 and D2 on the module. With the DIG1 and DIG2 parameters of FC 169, you determine at what point the module is to set the digital outputs.
  • Page 378 IP 240 Counter, Position Decoder and Positioning Module Interrupt Program Interrupt Block The interrupt program is located in the organization block OB 40. Enabling In the start-up program, the module is structured such that when tracks 1 or 3 Interrupts are reached (PRA = W#16#0005) an interrupt is generated.
  • Page 379 IP 240 Counter, Position Decoder and Positioning Module Programming Example for “Positioning” Mode Prerequisites, Settings, Blocks and Addresses Overview The programming example describes the standard functions for operating the IP 240 counter, position decoder and positioning module in “Positioning” mode. Objectives of the programming example: The example should show the most important functions in exemplary form.
  • Page 380 IP 240 Counter, Position Decoder and Positioning Module The following interrupt settings are required in the CPU: Process interrupt: OB 40, Interrupt I1 (S5 assignment: IA). Settings on the “Positioning” mode: IP 240 required switch setting S1: No process interrupts via IB 0 S2: Interrupt circuit A, I/O area P S3: I/O address 0 S4: Sensor signals symmetrical...
  • Page 381 IP 240 Counter, Position Decoder and Positioning Module Addresses The inputs and outputs are mapped onto memory bits at the beginning and end of OB 1. Within the test program, only the memory bits are used. Signal Memory Bit Description I 2.0 M 180.0 Execute function...
  • Page 382 IP 240 Counter, Position Decoder and Positioning Module Start-up Program and Error Responses Start-up Program The start-up program is in OB 100. When OB 100 has been processed, you can check the following entries with “Monitor/Modify variable”: DB 170.DBB 2 to DBB 7: Product code of the module DB 170.DBB 8 to DBB 13: Firmware version...
  • Page 383 IP 240 Counter, Position Decoder and Positioning Module Cyclic Program General Remarks The cyclic program is in OB 1. At the beginning of the program, the inputs are mapped to memory bits which are then used in the rest of the program. At the end of the program, the control memory bits are transferred to the outputs and displayed.
  • Page 384 IP 240 Counter, Position Decoder and Positioning Module Specifying a With the control word Position DB 168.DBW 38 FUNCTION = B#(21,1) and brief activation of the input I 1.0 (M190.0), position 1 is specified for approaching. The status bits now show the traversing direction to the position as well as the reaching of the clearance values: DB 168.DBX 59.1 RICH,...
  • Page 385 IP 240 Counter, Position Decoder and Positioning Module Setting Digital The LEDs in the front panel allow you to observe the setting of the digital Outputs outputs D1 and D2 on the module. With the DAV parameter of FC 167, you define the behavior of the digital outputs of the module at start-up (for example, DAV = 0;...
  • Page 386 IP 240 Counter, Position Decoder and Positioning Module Interrupt Program Interrupt Block The interrupt program is located in the organization block OB 40. Enabling In the start-up program, the module is structured such that when the clear- Interrupts ance value BEE1 is reached (PRA1 = W#16#0001) an interrupt is generated. Interrupt generation is initially blocked (control bit AMSK = ‘1’).
  • Page 387 Index EWA 4NEB 811 6120-02a...
  • Page 388 IP 240 Index Index 10-85, 10-86 ABIT 7-15, 10-36, 10-85, - numbers 10-10 10-86, 10-88 - representation 10-11 Actual value 7-3, 8-3, 10-23, 10-77 10-28, 10-57, 10-61, 10-77 10-76, 10-79 10-77 - acquisition 7-17, 7-26, 10-26 7-18, 7-21, 8-7, - change 10-70 8-9, 10-85, 10-86, - fluctuations...
  • Page 389 Index IP 240 Communication 11-2 Control bit 8-14, 10-55, 10-76, - cycle 11-2, 11-7 10-80, 11-4, 11-16, - errors 6-6, 7-25, 8-13, 9-7, 14-2 10-36, 14-1, 14-3, - ADD 10-69 14-6 - AMSK 10-36, 10-40, 10-80 - error flags - DA1S 10-39, 10-40, 10-54, - resetting 11-8, 11-9...
  • Page 390 IP 240 Index Digital output 7-6, 7-7, 10-17, D subminiature socket connector 10-56, 11-10 7-13, 7-26, 8-4, 8-5, - control 10-54 8-14, 11-10, 11-14 - D1 10-17 DA1F 7-26, 8-3, 8-14, - D2 10-17 11-13, 11-16 Direction 10-17, 10-18 DA1S 7-26, 8-3, 8-4, 8-14, - negative 10-18...
  • Page 391 Index IP 240 Encoder Final value 7-4, 7-5, 7-25, 7-29, - signal 2-2, 2-4, 4-8 ... 4-10, 8-3, 8-13, 8-15, 5-7, 6-1 10-15, 10-16, 10-31, - signal forms 13-1 10-35, 10-47, 10-57, - signal level 10-61, 10-76, 10-80, - signal matching 14-2 - supply 2-2, 2-4, 2-7, 5-1...
  • Page 392 IP 240 Index Interrupt Hardware 7-18 - cause 10-62 - fault 2-7, 6-3, 6-6, 10-36, - masking 10-36 14-1 - organization block (OB) 5-6, 10-36, 10-61, - fault flag/code/message 6-6, 14-1 10-91 - version 7-18, 8-7, 9-5, 10-85 - read request bytes 10-92, 11-15 HOLD time 13-7...
  • Page 393 Index IP 240 Module fault 14-1 Job request 11-4 Mounting position 3-1, 5-1 - identified 11-3 Multiprocessor operation - identifier 11-11 - number 10-37, 10-61, 10-74, 11-1, 11-4, 11-7 Nibble 10-11 - register 11-1, 11-2, 11-4, 7-27, 10-77, 11-11 11-5, 11-7, 11-14 NPUE 7-13, 7-15, 7-26, - servicing...
  • Page 394 IP 240 Index Parameter 10-86, 10-91, 14-3 Preliminary contact 2-2, 2-4, 4-5, 7-16, - assignment 7-18, 8-7, 10-85 7-17, 10-41,10-44 - assignment errors 6-6, 6-7, 7-18, 7-23, - edge 7-17 7-25, 8-7, 8-11, 8-13, - input 7-16 9-5, 9-7, 14-1, 14-3 - signal 7-16, 7-17, 10-38, - DBNR...
  • Page 395 Index IP 240 REF1 11-14 Shielding REF2 8-3, 11-15 - bus REF bit 7-5, 7-6, 7-14, 8-5 Short-circuit 10-33 Reference - in encoder line 10-70 - bit 7-15, 7-20, 8-8, 8-15 Sign - signal 2-2, 7-16 - bit 10-10 - tracks 7-1, 7-4, 7-5, 7-8, Signal 7-15, 7-19, 7-20...
  • Page 396 IP 240 Index Status bit Test voltage - DRBR 7-14, 10-33, 10-60, Tetrad 10-11 10-79 Thermistor - MESE 10-47, 10-60, 10-79 Three-wire BERO - NPUE 10-34, 10-60, 10-79 Time - RICH 10-5, 10-18, 10-59, - base 12-1 10-79 - critical 11-1 - RIUM 10-60, 10-79...
  • Page 397 Index IP 240 Write - control bit 10-90 - modified distance values 10-90 - modified position values 10-90 - modified zero offset 10-90 - position data for position 0 10-90 - position number 10-90 Write cycle 11-2, 11-7 Write request 11-1 10-77 Zero crossing...
  • Page 398 IP 240 Module Description and Accessories Module Description and Accessories General Technical Specifications Climatic Environmental Conditions Mechanical Environmental Conditions Temperature Vibration to IEC 68-2-6 Operation 0 to +55 °C - Tested with 10 to 57 Hz, (Intake air tem- (constant ampli- perature, tude 0,15 mm) measured at the...
  • Page 399 Module Description and Accessories IP 240 Technical Specifications The IP 240 has two independent channels. In the IP 252 expansion mode, the encoder signals are acquired as in the position decoding and positioning modes. The data relating to pulse inputs for position decoding therefore also apply to the IP 252 expansion.
  • Page 400 IP 240 Module Description and Accessories Input frequencies Pulse inputs: - Symmetrical signals max. 500 kHz in position decoding and positioning mode max. 200 kHz in IP 252 expansion mode - Asymmetrical signals max. 25 kHz for 100 m cable max.
  • Page 401 Module Description and Accessories IP 240 2.2.3 Inputs/Outputs The IP 240 provides two options for connecting sensors to the pulse inputs: • All sensor signals can be routed to the 15-pin subminiature D socket connectors X2/X4 ( Section 4.2.2) • Clock signals up to 10 kHz can also be routed over the 7-pin plug connectors X3/X5 ( Section 4.2.2).
  • Page 402 IP 240 Module Description and Accessories Data for rated voltage 24 V symmetrical pulse train Input voltage ranges to RS 422 A ”0”-Signal - 30to+ 5.0 V ”1”-Signal +16 to+ 30 V Input currents to RS 422 A ”0” signal - 16to+ 1.9 mA ”1”...
  • Page 403 Module Description and Accessories IP 240 Digital outputs Number of outputs 4 (2 per channel) Galvanic isolation in groups of Supply voltage Vp Rating 24 V DC Ripple 3.6 V max. Permissible range (including ripple) 20 to 30 V Output current for ”1” signal 0.5 A max.
  • Page 404 IP 240 Module Description and Accessories Encoder supply The power supply for 5 V encoders taken from the programmable controller's power supply and made available over subminiature D socket connectors X2 and X4 (pins 4 and 10) ( Section 4.2.2). If 24 V is needed, the IP 240 must be powered via the external connection on connector X6 provided for this purpose (24 V, 0 V).
  • Page 405 6ES5 848-7JC02 Fuse 0.8A F e. g. Wickmann No.TR5F 19370K 1.6A T Wickmann No.TR5T 19372K Position encoders with symmetrical signals e. g. Siemens, No. 6FC9320-... Connecting cables for 6FC9320-3..00 position decoders 6ES5 705-3BF01 6ES5 705-3CB01 6ES5 705-3CC01 6ES5 705-3CD21 Connectors Socket connector, 2-pin (Weidmüller, BLA 12817.0)
  • Page 406 IP 240 Addressing Addressing The IP 240 module reserves an address space of 16 bytes in the I/O areas. All data are exchanged via these areas, which can be read out and written to by the S5 CPU. The data transfer is handled by a standard function block.
  • Page 407 Addressing IP 240 Programmable I/O area Starting Switch settings controller address Address area I/O area S5-115U S5-135U S5-150U S5-155U extended I/O area EWA 4NEB 811 6120-02...
  • Page 408 IP 240 Addressing Use of the IP 240 in expansion units S5-183U, S5-184U, S5-185U and S5-186U If you use the IP 240 in one of these EUs, set the start address on switchbank S3 as explained above. Setting the I/O area or the extended I/O area: •...
  • Page 409 IP 240 Operation Operation Before startup you must set various coding switches on the module. You can stipulate • interrupt generation with switchbanks S1 and S2 ( Section 5.1) • disabling of the digital outputs with switchbank S4 ( Section 5.2) •...
  • Page 410 Operation IP 240 Settings for Interrupt Generation The processing of interrupt signals makes it possible to respond rapidly to status changes. In the SIMATIC S5 programmable controllers, a distinction is made between two types of interrupts: • ”Servicing IRx interrupt circuits” (S5-115U, S5-135U and S5-155U in the 155U mode) •...
  • Page 411 IP 240 Operation If several IP 240 modules use one interrupt circuit, the current interrupt source must be determined by reading the interrupt request bytes of all modules or by additonally evaluating I/O byte 0. This must be taken into account in the STEP 5 program due to the system characteristics of the S5-115U CPUs ( Section 5.1.2).
  • Page 412 Operation IP 240 Switchbank S1 Switchbank S2 PB 0.0 I/O byte 0.0 to 0.7 Master or Slave Enable for I/O byte 0 Fig. 5-3. Allocation of Coding Switches on Switchbanks S1 and S2 to Interrupt Generation with I/O Byte 0 The coding switches on banks S1 and S2 shown in Fig.
  • Page 413 IP 240 Operation Example for setting the coding switches Three IP 240s are to be enabled for interrupt generation. One IP 240 is to be operated as master module and the other two as slave 1 and slave 2. Slave 1 is assigned to PY 0.1 and slave 2 to PY 0.2. Bits PY 0.3 to PY 0.6 are reserved by other modules.
  • Page 414 Operation IP 240 Additional programming in the organization blocks for the S5-115U: a) The interrupt service routine must be programmed in an FB so that it may execute several times. • I/O byte 0 must be read once at the beginning of interrupt processing to determine which IP triggered the interrupt.
  • Page 415 IP 240 Operation Matching to Encoder Signals Encoders with 24 V DC signals and encoders which generate signals to the RS 422 A or a similar standard can be connected to the inputs of the IP 240. The user can set coding switches for matching the IP 240 to the encoder signals.
  • Page 416 Siemens AG AUT E 148 Postfach 1963 D-92209 Amberg Federal Republic of Germany From: Your Name: Your Title: Company Name: Street: City, Zip Code: Country: Phone: Please check any industry that applies to you: Automotive Pharmaceutical Chemical Plastic Electrical Machinery...
  • Page 417 Your comments and recommendations will help us to improve the quality and usefulness of our publications. Please take the first available opportunity to fill out this questionnaire and return it to Siemens. Title of Your Manual: Order No. of Your Manual:...

Table of Contents