Siemens S7-300 Operating Instructions Manual

Siemens S7-300 Operating Instructions Manual

Fm 352 electronic cam controller
Hide thumbs Also See for S7-300:
Table of Contents
FM 352 electronic cam controller
SIMATIC
S7-300
FM 352 electronic cam controller
Operating Instructions
05/2011
A5E01071724-03
___________________
Preface
___________________
Product overview
___________________
Cam control basics
Installing and removing the
___________________
FM 352
___________________
Wiring the FM 352
___________________
Installing the software
___________________
Programming the FM 352
___________________
Commissioning the FM 352
___________________
Machine and cam data
___________________
Settings
___________________
Encoders
___________________
Diagnostics
___________________
Examples
___________________
Technical data
___________________
Connection Diagrams
___________________
Data blocks / error lists
___________________
Programming without
SFB 52 and SFB 53
1
2
3
4
5
6
7
8
9
10
11
12
13
A
B
C
D
Table of Contents
loading

Summary of Contents for Siemens S7-300

  • Page 1 FM 352 electronic cam controller Preface ___________________ Product overview ___________________ Cam control basics SIMATIC Installing and removing the ___________________ FM 352 S7-300 ___________________ FM 352 electronic cam controller Wiring the FM 352 ___________________ Installing the software Operating Instructions ___________________ Programming the FM 352 ___________________...
  • Page 2 Note the following: WARNING Siemens products may only be used for the applications described in the catalog and in the relevant technical documentation. If products and components from other manufacturers are used, these must be recommended or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and maintenance are required to ensure that the products operate safely and without any problems.
  • Page 3: Table Of Contents

    Table of contents Preface ..............................7 Product overview ............................. 11 The FM 352..........................11 Fields of application of FM 352 ....................12 Configuration of an electronic cam control with FM 352..............13 Cam control basics ..........................15 Properties of the cam types ......................15 Tracks and track result.........................18 3.2.1 Standard tracks..........................18...
  • Page 4 Table of contents Interrupts ............................. 52 Evaluation of a hardware interrupt ....................53 Evaluating a diagnostics interrupt ....................54 Technical data..........................55 7.10 High-speed access to module data..................... 56 7.11 Parameter transmission paths ....................58 Commissioning the FM 352 ........................61 Machine and cam data ..........................
  • Page 5 Table of contents 10.10 Simulating ..........................126 10.11 Read "count values of counter cam tracks" ................128 10.12 Read "position and track data"....................130 10.13 Read encoder data ........................131 10.14 Read cam and track data......................132 10.15 Setting control signals for the cam controller................133 10.16 Querying checkback signals for the cam controller ..............134 10.17...
  • Page 6 Connection Diagram for Incremental Encoder Siemens 6FX 2001-2 (Up=24V; RS 422) ..172 Wiring Diagram of the Incremental Encoder Siemens 6FX 2001-4 (Up = 24 V; HTL) ..... 174 Connection Diagram for Absolute Encoder Siemens 6FX 2001-5 (Up=24V; SSI) ....176 Data blocks / error lists ..........................
  • Page 7: Preface

    Preface Purpose of the manual This manual gives you a complete overview of the FM 352 function module. It helps you during installation and commissioning. The procedures involved in installation, wiring, parameter assignment, and programming are described. This manual is intended for the programmers of STEP 7 programs and for those responsible for configuring, commissioning, and servicing automation systems.
  • Page 8 Preface Standards The SIMATIC S7-300 product series is compliant with IEC 61131-2. Recycling and disposal The FM 352 is low in contaminants and can therefore be recycled. For ecologically compatible recycling and disposal of your old device, contact a certificated disposal service for electronic scrap.
  • Page 9 Technical Support You can access technical support for all A&D projects via the following: ● Online support request form: (http://www.siemens.com/automation/support-request) Service & Support on the Internet In addition to our documentation, we offer a comprehensive online knowledge base on the...
  • Page 10 Preface FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 11: Product Overview

    The FM 352 The FM 352 function module is a single-channel, electronic cam controller for integration in the S7-300 automation system. It supports rotary and linear axes. The module supports initiators and incremental or absolute encoders (SSI) for position feedback. When operating in slave mode, the FM 352 can listen in on the SSI frame of an absolute encoder.
  • Page 12: Fields Of Application Of Fm 352

    Product overview 2.2 Fields of application of FM 352 Fields of application of FM 352 Example: Applying glue tracks In the following example, glue tracks are applied to wooden boards. Each cam track controls one glue nozzle via a digital output. Figure 2-1 Example of an electronic cam control Example: Press control...
  • Page 13: Configuration Of An Electronic Cam Control With Fm 352

    Product overview 2.3 Configuration of an electronic cam control with FM 352 Configuration of an electronic cam control with FM 352 Components of the electronic cam control The figure below shows the components of an electronic cam control. These are described briefly below.
  • Page 14 Product overview 2.3 Configuration of an electronic cam control with FM 352 FM 352 electronic cam controller The electronic cam controller determines the actual position value of the axis based on an encoder signal. It evaluates the encoder signals (for example, by counting the pulses) which are proportional to the distance traveled.
  • Page 15: Cam Control Basics

    Cam control basics Properties of the cam types Cam types You can assign each cam for operation as a position-based cam or time-based cam. The table below shows a comparison of the properties of both cam types. Table 3- 1 Definition and switching of the two cam types Position-based cam Time-based cam...
  • Page 16 Cam control basics 3.1 Properties of the cam types Position-based cam Time-based cam Enabling The cam is activated: The cam is activated: at the cam start, if the axis is at the cam start, if the axis is   moving in positive direction and moving in positive direction, and a positive effective direction is set.
  • Page 17 Cam control basics 3.1 Properties of the cam types Inverse cam An inverse cam comes about if the cam start is greater than the cam end. The following table shows the effect of an inverse cam with a linear axis and a rotary axis. Inverse cam with a linear axis Inverse cam with a rotary axis The cam start (NA) is greater than the cam end...
  • Page 18: Tracks And Track Result

    Cam control basics 3.2 Tracks and track result Tracks and track result 3.2.1 Standard tracks Cam tracks The 32 tracks can be used to control up to 32 different switching actions. You can evaluate the tracks based on the checkback signals. The first 13 tracks (track 0 to 12) are each assigned a digital output (Q0 to Q12) of FM 352.
  • Page 19 Cam control basics 3.2 Tracks and track result External enable of track 3 You can assign an external enable signal for track 3 in the machine data. Track signal 3 is then logically linked to digital input I3 by an AND operation, before it can switch digital output Q3 of the FM 352.
  • Page 20: Special Tracks

    Cam control basics 3.2 Tracks and track result 3.2.2 Special tracks Definition You can program tracks 0 to 2 for operation as special tracks: ● Track 0 or 1: Counter cam track ● Track 2: Brake cam track Input I0 must be evaluated in order to enable the track. Requirements Requirements of working with special tracks: ●...
  • Page 21 Cam control basics 3.2 Tracks and track result Brake cam track In order to use track 2 as a brake cam track, interconnect digital input I0. A positive edge of the I0 signal sets the track flag bit. The track flag bit is reset again when: ●...
  • Page 22: Hysteresis

    Cam control basics 3.3 Hysteresis Hysteresis Definition Mechanical imbalance at the axis may cause fluctuation of the actual position value. If the actual position value is offset by one edge of a cam, or within an active cam with only one effective direction, this cam's activation would be cycled on and off continuously.
  • Page 23 Cam control basics 3.3 Hysteresis Directional reversal of a cam with hysteresis The table illustrates the reaction to directional reversal. A distinction must be made between the reaction of position- and time-based cams. The effective direction of the cam is positive. Table 3- 2 Directional reversal of a cam Position-based cam...
  • Page 24: Dynamic Adjustment

    Cam control basics 3.4 Dynamic adjustment Dynamic adjustment Task The dynamic adjustment is used to compensate delay times of the connected control elements. Derivative-action time You can program a delay time and assign it as derivative-action time to each cam. You can assign one derivative-action time to each cam.
  • Page 25: Interfaces Of The Cam Controller

    Cam control basics 3.5 Interfaces of the cam controller Interfaces of the cam controller Overview The graphic below contains a schematic diagram of the main interfaces to illustrate the relationship between data, inputs, and outputs. Figure 3-4 Interfaces of FM 352 Description ①...
  • Page 26 Cam control basics 3.5 Interfaces of the cam controller Description ④ Using machine data, you can control whether the previously determined track identifier bits of tracks 0 to 12 of the cam controller are passed on, or whether they are set directly by the track enable signal (TRACK_EN).
  • Page 27: Installing And Removing The Fm 352

    Installing and removing the FM 352 Important safety rules Certain important rules and regulations govern the integrating of an S7-300 with FM 894.08 cm a plant or system. These are described in the Operating Instructions SIMATIC S7-300 CPU 31xC and CPU 31x: Installation (http://support.automation.siemens.com/WW/view/en/13008499).
  • Page 28 4. After installation, you can assign a slot number to FM 352. For this purpose, the CPU comes with slot plates. The required numbering scheme and the procedure for inserting the slot plates can be found in the Operating Instructions SIMATIC S7-300 CPU 31xC and CPU 31x: Installation (http://support.automation.siemens.com/WW/view/en/13008499). 5. Install the shield connection element.
  • Page 29: Wiring The Fm 352

    Wiring the FM 352 Before you start wiring Important safety rule It is imperative for system safety to install the switchgear listed below, and to adapt these to system conditions. ● EMERGENCY STOP switch to shut off the entire system. ●...
  • Page 30: Description Of The Encoder Interface

    (5 V) A/DAT Encoder signal A (5 V) SSI data In listen-in mode See chapter "Wiring Diagram of the Incremental Encoder Siemens 6FX 2001-4 (Up = 24 V; HTL) (Page 174)". FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 31: Connecting The Encoder

    The shield connection element is a comfortable means of bonding all shielded cables to ground, due to the direct connection between the shield connection element and the rack. You will find detailed information in the Operating Instructions SIMATIC S7-300 CPU 31xC and CPU 31x: Installation (http://support.automation.siemens.com/WW/view/en/13008499).
  • Page 32: Terminal Assignment Of The Front Connector

    5 V DC at the encoder interface (sub D socket X2) to the various types of encoders. The general technical data and requirements for the DC load power supplies are described in the Operating Instructions SIMATIC S7-300 CPU 31xC and CPU 31x: Installation (http://support.automation.siemens.com/WW/view/en/13008499).
  • Page 33 Wiring the FM 352 5.4 Terminal assignment of the front connector 4 digital inputs (I0 to I3) You can connect bounce-free switches (24 V current sourcing) or non-contact sensors (2- or 3-wire proximity switches) to the 4 digital inputs. The digital inputs are not monitored for short circuits or wire break and have a non-isolated connection to the module chassis.
  • Page 34: Wiring The Front Connector

    Wiring the FM 352 5.5 Wiring the front connector Wiring the front connector Connecting cables ● The cables for digital IO must be shielded if they exceed a certain lengths: – Digital inputs: cable length > 32 m – Digital outputs: cable length > 100 m ●...
  • Page 35 Wiring the FM 352 5.5 Wiring the front connector Procedure WARNING Personal injury and damage to equipment on account of unshielded voltage. If you wire the FM 352 front connector while the system is in live state, you will risk injury from electric shock! Always switch off power before you wire the FM 352! If no EMERGENCY OFF switch is installed, damage may be caused by connected...
  • Page 36 Wiring the FM 352 5.5 Wiring the front connector FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 37: Installing The Software

    FM 352 ● SIEMENS\STEP7\MANUAL: Getting Started, Manuals Note If, when installing STEP 7, you chose a directory other than SIEMENS\STEP7, this directory will be entered. Configuring and assigning parameters For further information, refer to the chapter "Commissioning the FM 352 (Page 61)".
  • Page 38 Installing the software FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 39: Programming The Fm 352

    If your CPU supports the system blocks SFB 52 and SFB 53 with DPV1 functionality Then use the blocks from the program folder "FM 352 CAM V2" to program the FM 352. In addition to centralized use in the S7-300, these blocks also support distributed use with PROFINET and PROFIBUS DP.
  • Page 40: Basics Of Programming An Fm 352

    Programming the FM 352 7.1 Basics of Programming an FM 352 Basics of Programming an FM 352 Task You can assign parameters, control, and commission the FM 352 module via a user program. To exchange data between the user program and module, you use the functions (FCs) and data blocks (DBs) described below.
  • Page 41 Programming the FM 352 7.1 Basics of Programming an FM 352 ● Enter the module address in the channel DB and, if necessary, also in the diagnostic DB in the MOD_ADDR parameter. Proceed as follows to enter the module address: –...
  • Page 42: Fc Cam_Init (Fc 0)

    Programming the FM 352 7.2 FC CAM_INIT (FC 0) FC CAM_INIT (FC 0) Tasks FC CAM_INIT initializes the following data in the channel DB: ● The control signals ● The checkback signals ● The trigger, done and error bits of the jobs ●...
  • Page 43: Fb Cam_Ctrl (Fb 1)

    Programming the FM 352 7.3 FB CAM_CTRL (FB 1) FB CAM_CTRL (FB 1) Tasks You can use FB CAM_CTRL to read operating data from the module, initialize the module, and control it during operation. For these tasks, you use the control signals, checkback signals, and write and read jobs.
  • Page 44 Programming the FM 352 7.3 FB CAM_CTRL (FB 1) Jobs Data exchange with the module other than the control and checkback signals is handled using jobs. To start a job, set the corresponding trigger bit in the channel DB and provide the relevant data for write jobs.
  • Page 45 Programming the FM 352 7.3 FB CAM_CTRL (FB 1) Startup Call FC CAM_INIT at the startup of the module or CPU (see chapter "FC CAM_INIT (FC 0) (Page 42)"). Among other things, this resets the function switches. FB CAM_CTRL acknowledges the module startup. During this time, RETVAL and JOBBUSY = 1.
  • Page 46 Programming the FM 352 7.3 FB CAM_CTRL (FB 1) Reaction to errors If faulty data were written by a write job, the module returns the message DATA_ERR = 1. If an error occurs during communication with the module for a write or read job, the cause of the error is entered in the JOB_ERR parameter in the channel DB.
  • Page 47: Fb Cam_Diag (Fb 2)

    Programming the FM 352 7.4 FB CAM_DIAG (FB 2) FB CAM_DIAG (FB 2) Tasks Use FB CAM_DIAG to read the diagnostic buffer of the module and make it available for display on an operator control and monitoring system or for a programmed evaluation. Call The function block must be called cyclically.
  • Page 48 Programming the FM 352 7.4 FB CAM_DIAG (FB 2) Return values The block returns the following return values in the RETVAL parameter of the diagnostic DB in word 302: RETVAL Description Job active No job active, no error Error Reaction to errors The cause of a job error can be found in the JOB_ERR parameter of the diagnostic DB (see chapter "Diagnostics (Page 145)"...
  • Page 49: Data Blocks

    Programming the FM 352 7.5 Data blocks Data blocks 7.5.1 Templates for data blocks The included FM352LIB library contains a block template (UDT) for the different variants of the machine data DB. Based on this UDT, you can create data blocks with user-specific numbers and names.
  • Page 50: Diagnostic Db

    Programming the FM 352 7.5 Data blocks 7.5.3 Diagnostic DB Task The diagnostic DB is the data storage for the FB CAM_DIAG and contains the diagnostic buffer of the module that has been prepared by this block. Configuration Diagnostic DB Module address Internal data Job status...
  • Page 51: Parameter Db

    Programming the FM 352 7.5 Data blocks 7.5.4 Parameter DB Task All machine and cam data are stored in the parameter DB. These parameters can be modified by the user program or by an operator control and monitoring system. The modified data can be imported to the parameter assignment interface and displayed there.
  • Page 52: Interrupts

    Programming the FM 352 7.6 Interrupts Interrupts Interrupt processing The FM 352 can trigger hardware and diagnostic interrupts. You process those interrupts in an interrupt OB. If an interrupt is triggered and the corresponding OB is not loaded, the CPU Programming with STEP 7 goes to STOP mode (refer to the Manual).
  • Page 53: Evaluation Of A Hardware Interrupt

    Programming the FM 352 7.7 Evaluation of a hardware interrupt Evaluation of a hardware interrupt If the FM 352 triggers a hardware interrupt, the following information is available in the OB40_POINT_ADDR variable (or in the corresponding variable of a different hardware interrupt OB): Table 7- 1 Content of double word OB40_POINT_ADDR...
  • Page 54: Evaluating A Diagnostics Interrupt

    Programming the FM 352 7.8 Evaluating a diagnostics interrupt Evaluating a diagnostics interrupt Following a diagnostic interrupt, the diagnostic information is available in the variables of OB 82 and can be used for a fast analysis. Call the CAM_DIAG block to find out the exact cause of the error by reading the diagnostic buffer.
  • Page 55: Technical Data

    Programming the FM 352 7.9 Technical data Technical data Overview The table below provides an overview of the technical specifications for the FM 352 blocks. Table 7- 2 Technical specifications for FM 352 blocks Block name Version Allocation Allocation in Allocation in MC7 code / System functions...
  • Page 56: High-Speed Access To Module Data

    Programming the FM 352 7.10 High-speed access to module data 7.10 High-speed access to module data Application Very fast access to checkback and control signals is required in special applications or in an alarm level. You can obtain those data directly by reading the IO areas of the module. To coordinate startup following each module startup (for example, after inserting a module, CPU STOP →...
  • Page 57 Programming the FM 352 7.10 High-speed access to module data Direct write access to control signals The byte addresses are defined with an offset to the input address of the module. The bit names correspond to the names in the channel DB. In STL, you access the data using the PQB (write 1 byte) and PQW (write 2 bytes) commands.
  • Page 58: Parameter Transmission Paths

    Programming the FM 352 7.11 Parameter transmission paths 7.11 Parameter transmission paths Transmission paths The term parameter refers to the following machine and cam data. Figure 7-1 Parameter transmission paths Save the parameters in the parameter assignment interface. Saving and compiling the HW configuration, and download to the CPU. The CPU writes the parameters to the module during system parameter assignment.
  • Page 59 Programming the FM 352 7.11 Parameter transmission paths Some use cases for the transfer of parameters Use case Steps You edit the parameters on the parameter assignment interface. Perform steps 1, 2, and 3. The parameter should then be assigned automatically to the module during startup.
  • Page 60 Programming the FM 352 7.11 Parameter transmission paths FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 61: Commissioning The Fm 352

    Commissioning the FM 352 Important notes Please observe the points listed in the following warnings. WARNING In order to prevent injury and material damage: Install an EMERGENCY STOP switch in the area of the computer. This is the only way to ensure that the system can be switched off safely in the event of a computer or software failure.
  • Page 62 Commissioning the FM 352 Hardware installation and wiring In this first section, you install the FM 352 in your S7-300, and wire the front connector. Step Description ✓ Installing the FM 352 (see chapter "Installing and removing the FM 352 (Page 27)")
  • Page 63 Commissioning the FM 352 Assigning parameters using the parameter assignment interface For initial commissioning of the module, assign parameters for the module using the parameter assignment interface. Observe the following order: Step Description ✓ Select the tier in the rack containing the FM 352 module. ❑...
  • Page 64 Commissioning the FM 352 Test steps for axis synchronization and switching characteristics The tests described in the next section help you to validate FM 352 parameter assignment. Step Description ✔ Synchronize the axis ❑ Incremental encoder Absolute encoder   –...
  • Page 65 Commissioning the FM 352 Preparing the channel DB Step Description ✔ Open the channel DB. ❑ Make sure that the module address is entered in the MOD_ADDR ❑ parameter (refer to the section entitled Basics of Programming an FM 352 (Page 40)).
  • Page 66 Commissioning the FM 352 FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 67: Machine And Cam Data

    Machine and cam data Machine and cam data General information This chapter is relevant if you want to write the parameters directly to the module in the user program, and without using the programming interface. All machine and cam data are saved in the parameter DB. You must enter the parameter DB number in the associated channel DB in each case.
  • Page 68: Writing And Enabling Machine Data

    Machine and cam data 9.2 Writing and enabling machine data Writing and enabling machine data General Machine data are used to adapt the FM 352 to the axis and encoder. Machine data are stored in the parameter DB at addresses 3.1 to 104.0. Initial parameter assignment If the module does not yet contain machine data (checkback signal PARA = 0), follow these steps to initially assign parameters without the parameter assignment interface:...
  • Page 69: Writing And Enabling Machine Data

    Machine and cam data 9.2 Writing and enabling machine data 4. Check to see if the revised machine data were transmitted and enabled successfully by evaluating the done bit (_D ending) and error bit (_ERR ending) assigned to each job: –...
  • Page 70: Read Machine Data

    Machine and cam data 9.3 Read machine data Read machine data Procedure To read actual machine data from the module: 1. Set the following trigger bit in the channel DB: – Read machine data (MDRD_EN) 2. Call FB CAM_CTRL in the cyclic user program. This saves the current machine data to the parameter DB on the CPU.
  • Page 71: Writing Cam Data

    Machine and cam data 9.4 Writing cam data Writing cam data Writing cam data Cam data define the type and function principle of the cams and their assignment to the tracks. Cam data are stored in the parameter DB, starting at address 108.0. These data are grouped in packets, each consisting of 16 cams.
  • Page 72: Reading Cam Data

    Machine and cam data 9.5 Reading cam data Reading cam data Reading cam data To read actual cam data from the module: 1. Set the following trigger bit in the channel DB: – Read cam data (CAM1RD_EN to CAM8RD_EN) 2. Call FB CAM_CTRL in the cyclic user program. This saves the actual cam data to the parameter DB on the CPU.
  • Page 73: Physical Units System

    Machine and cam data 9.6 Physical units system Physical units system Selecting a system of units You can choose a specific system of units for the input and output of data in the parameter assignment interface of the cam controller (default: mm). You can set any of the following as the system of units: ●...
  • Page 74 Machine and cam data 9.6 Physical units system Default system of units This manual always specifies limits using mm as the system of units To define the limits in another system of units, convert the values as shown below: To convert..you calculate...
  • Page 75: Machine Data Of The Axis

    Machine and cam data 9.7 Machine data of the axis Machine data of the axis Axis type Address Name Type Start value Comment 12.0 AXIS_TYPE DINT Axis type 0 = linear axis 1 = rotary axis A linear axis has a limited physical traversing range. A rotary axis is not restricted in its motion range by mechanical limit stops.
  • Page 76 Machine and cam data 9.7 Machine data of the axis End of rotary axis Address Name Type Start value Comment 16.0 ENDROTAX DINT L#100000 End of rotary axis Range: 1 µm to +1 000 000 000 µm The "end of rotary axis" value is theoretically the highest actual value of the axis. However, the theoretical maximum value is never indicated, because it also represents the physical start position of the rotary axis (= zero).
  • Page 77 Machine and cam data 9.7 Machine data of the axis Retrigger reference point: Address Name Type Initial value Comment 52.0 RETR_TYPE DINT Type of reference point retriggering Ranges: 0 = reference point switch and zero mark direction + 1 = reference point switch and zero mark direction - 6 = only reference point switch 7 = only zero mark...
  • Page 78 Machine and cam data 9.7 Machine data of the axis Software limit switch start and end Address Name Type Initial value Comment 64.0 SSW_STRT DINT L# -100 000 000 Software limit switch start 68.0 SSW_END DINT L# 100 000 000 Software limit switch end Range: - 1 000 000 000 µm to 1 000 000 000 µm...
  • Page 79 Machine and cam data 9.7 Machine data of the axis Hysteresis Address Name Type Initial value Comment 80.0 DINT Hysteresis Ranges: 0 to 65 535 [Imp] x resolution [ µm The range of values is determined by the resolution: Maximum input value: - to linear axes: max.
  • Page 80 Machine and cam data 9.7 Machine data of the axis Time-based cam with hysteresis A time-based cam is activated when: ● the cam start is crossed in the effective direction, and ● no hysteresis is set. Note The hysteresis will hide a time-based cam if its range between the reversal point and the cam start is less than the hysteresis.
  • Page 81 Machine and cam data 9.7 Machine data of the axis Simulation velocity Address Name Type Initial value Comment 84.0 SIM_SPD DINT Simulation velocity The simulation velocity depends on the resolution. 0 = standstill 5 ∗ 10 = highest setting supported by the module Within this range, the simulation velocity depends on the resolution:...
  • Page 82: Determining The Correct Absolute Encoder Adjustment

    Machine and cam data 9.8 Determining the correct absolute encoder adjustment Determining the correct absolute encoder adjustment Definition The absolute encoder adjustment and reference point coordinate maps the encoder's range of values unambiguously to the axis coordinate system. Address Name Type Start value Comment...
  • Page 83 Machine and cam data 9.8 Determining the correct absolute encoder adjustment Data in the channel DB Address Name Type Start value Comment 98.0 REFPT DINT Reference point coordinate Range: - 1 000 000 000 µm to + 1 000 000 000 µm FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 84: Example: Adjusting The Absolute Encoder

    Machine and cam data 9.9 Example: Adjusting the absolute encoder Example: Adjusting the absolute encoder Assumptions For this example, let us presume: ● Reference point coordinate = -125 mm ● Working range of SSW_STRT = - 1000 mm to SSW_END = 1000 mm ●...
  • Page 85 Machine and cam data 9.9 Example: Adjusting the absolute encoder Result of "Set reference point" The Set reference point operation creates the following relationship between the encoder and coordinate system: The reference point coordinate on the axis (-125) is assigned to the encoder value (1798) which is determined by the absolute encoder adjustment.
  • Page 86: Machine Data Of The Encoder

    Machine and cam data 9.10 Machine data of the encoder 9.10 Machine data of the encoder Definition The encoder returns position data to the module for evaluation and conversion to an actual value based on the resolution. The correct definition of the encoder's machine data is essential for ensuring consistency between the calculated and physical actual position of the axis.
  • Page 87 Machine and cam data 9.10 Machine data of the encoder Distance per encoder revolution Address Name Type Initial value Comment 24.0 DISP_REV DINT L#80000 Distance per encoder revolution 1 µm to 1 000 000 000 µm With the "Distance per encoder revolution" machine data, you inform the FM 352 about the distance covered by the drive system per encoder revolution.
  • Page 88 Machine and cam data 9.10 Machine data of the encoder Encoder type Frame length / type Range of values can be used as linear axis Single-turn encoder 13-bit half fir tree 64 ... 8192 in powers of 2 Single-turn encoder 13-bit right-justified 64 ...
  • Page 89 Machine and cam data 9.10 Machine data of the encoder Baud rate Address Name Type Initial value Comment 40.0 BAUD RATE DINT Baud rate Range of values: 0 = 125 kHz 1 = 250 kHz 2 = 500 kHz 3 = 1000 kHz With the "BAUDRATE"...
  • Page 90 Machine and cam data 9.10 Machine data of the encoder Monitoring Address Name Type Initial value Comment Monitoring MON_WIRE BOOL TRUE 1 = wire break 63.0 63.1 MON_FRAME BOOL TRUE 1 = frame error (must always be 1) 63.2 MON_PULSE BOOL TRUE 1 = missing pulses...
  • Page 91: Resolution

    Machine and cam data 9.11 Resolution 9.11 Resolution Definition The resolution reflects the accuracy of cam processing. It also determines the maximum possible traversing range. The resolution (RES) is calculated as follows: Incremental encoder Absolute encoder / initiator Input values Distance per encoder Distance per encoder ...
  • Page 92 Machine and cam data 9.11 Resolution Example ● An incremental encoder has the following data: – Increments per encoder revolution: 5000 – Distance per encoder revolution: 1000 mm – 1 increment = 4 pulses Resultant resolution (quadruple evaluation): Resolution = 1000 mm / 5000 increments = 0.2000 increment = 0.2000...
  • Page 93 Machine and cam data 9.11 Resolution Dependency between the velocity and resolution The velocity indicated may vary within the following limits, depending on the resolution (data relate to mm units): ● from 1 to 90 , at a resolution < 1 µm µm pulse...
  • Page 94: Quantity Framework And Track Data

    Machine and cam data 9.12 Quantity framework and track data 9.12 Quantity framework and track data Number of cams The number of cams available determines the cam cycle time and the maximum number of assignable cams. Number of cams Cam cycle time 16 cams 20.48 µs 32 cams...
  • Page 95 Machine and cam data 9.12 Quantity framework and track data Enable input Address Name Type Start value Comment Enable input 95.0 EN_IN_I3 BOOL FALSE 1 = track signal track 3 AND enable input I3 Bits 95.1 to 95.7 must be 0. The track signal Q3 is activated when all the following conditions have been met: •...
  • Page 96: Interrupt Enable

    Machine and cam data 9.13 Interrupt enable 9.13 Interrupt enable Definition In the cam data, you can specify whether hardware interrupts are to be generated when cams 0 to 7 are activated and/or deactivated (see chapter "Cam data (Page 97)"). Machine data for interrupt enable in the parameter DB Address Name...
  • Page 97: Cam Data

    Machine and cam data 9.14 Cam data 9.14 Cam data Definition Cam data describe the properties of a cam, the assignment of each cam to a track, and the switching characteristic of the cam. The cam data listed below are set separately at each cam.
  • Page 98 Machine and cam data 9.14 Cam data Description Position-based cam Time-based cam A cam is approached from any direction, and exited into any direction; both directions are set as effective direction Assigned cam Switched cam Cam data in the parameter DB Address Name Type...
  • Page 99 Machine and cam data 9.14 Cam data Cam start (NA)/Cam end (NE) of positioning cams Address Name Type Initial value Comment relative Of position-based cams +2.0 CBEGIN DINT L#-100000000 Cam start (NA) +6.0 CEND DINT L#100000000 Cam end (NE) Range: - 1 000 000 000 µm to 1 000 000 000 µm Minimum length of a position-based cam...
  • Page 100 Machine and cam data 9.14 Cam data Cam start (NA)/Cam end (NE) for time-based cam Address Name Type Initial value Comment relative of time cams +2.0 CBEGIN DINT L#-100000000 Cam start (NA) +6.0 CEND DINT L#100000000 Cam end (NE) Activation time Range: (0 to 13421) x 100 µs with up to 16 cams (0 to 26843) x 100 µs with up to 32 cams...
  • Page 101 Machine and cam data 9.14 Cam data Lead time Address Name Type Initial value Comment relative + 10.0 LTIME Lead time Range: (0 to 53686) x 100 µs with max. 16 cams (0 to 65535) x 100 µs with max. 32, 64 or 128 cams You can compensate any delays caused by the connected switchgear by setting a lead time.
  • Page 102 Machine and cam data 9.14 Cam data Note The actual lead time is always less than the assigned lead time. It may be 0, even though the assigned lead time ≥100 µs. The anticipation distance of a rotary axis must be less than the rotary axis range and the inactive part of the cam.
  • Page 103: Settings

    Settings 10.1 Influence of settings on the switching characteristics of time-based cams Actual value changes A time cam can be skipped by the following settings that change the actual value: ● Set actual value ● Set actual value on-the-fly ● Zero offset ●...
  • Page 104: 10.2 Set Actual Value/Set Actual Value On-The-Fly/Cancel Set Actual Value

    Settings 10.2 Set Actual Value/Set Actual Value on-the-fly/Cancel Set Actual Value 10.2 Set Actual Value/Set Actual Value on-the-fly/Cancel Set Actual Value Definition You program the "Set actual value/Set actual value on-the-fly" settings in order to assign a new coordinate to the actual encoder value. This shifts the coordinate system by the value: - ACT current Whereby:...
  • Page 105 Settings 10.2 Set Actual Value/Set Actual Value on-the-fly/Cancel Set Actual Value Data used in the channel DB Address Name Type Initial value Comment 36.4 AVAL_EN BOOL FALSE 1 = set actual value 36.5 FVAL_EN BOOL FALSE 1 = set actual value on-the-fly 90.0 AVAL DINT...
  • Page 106 Settings 10.2 Set Actual Value/Set Actual Value on-the-fly/Cancel Set Actual Value Table 10- 1 Shift of the coordinate system by "Set Actual Value" / "Set Actual Value on-the-Fly" Set actual value [mm] [mm] [mm] [mm] -400 -200 -200 Canceling the setting The "Cancel set actual value"...
  • Page 107: Set Zero Offset

    Settings 10.3 Set zero offset 10.3 Set zero offset Definition The "zero offset" setting lets you shift the zero position in the coordinate system by a defined value. The sign determines the offset direction. Determining a new coordinate All values of the shifted coordinate system can be calculated according to the following formula: Coordinate = Coordinate...
  • Page 108 Settings 10.3 Set zero offset Data used in the channel DB Address Name Type Initial value Comment 36.6 ZOFF_EN BOOL FALSE 1 = set zero offset 86.0 ZOFF DINT Zero offset Effects on a linear axis Based on the example of a zero offset of -200 mm, you can see that this setting shifts the coordinate system in positive direction.
  • Page 109 Settings 10.3 Set zero offset Effects on a rotary axis Based on the example of a zero offset by -45° , you can see how this setting rotates the coordinate system: Table 10- 3 Rotation of the coordinate system as a result of zero offset Tool at ACT = 340°...
  • Page 110: Set Reference Point

    Settings 10.4 Set reference point 10.4 Set reference point Definition The "set reference point" setting is used to synchronize the axis. This setting shifts the working area. All shifts generated by a zero offset or "set actual value" function are retained. The setting maps the working range onto the axis.
  • Page 111 Settings 10.4 Set reference point Effects of the setting Based on the example "set reference point" to 300 mm, you can see how this setting shifts the working range of the axis. This has the following effects: ● The actual position is set to the value of the reference point coordinate. ●...
  • Page 112: Change Cam Edges

    Settings 10.5 Change cam edges 10.5 Change cam edges Definition The "change cam edges" setting can be used to change the cam start during operation. With a position-based cam, the cam end of an individual position-based cam can also be changed during operation.
  • Page 113 Settings 10.5 Change cam edges Effects of the setting The FM 352 first shifts the on-triggering edge, and then the off-triggering edge of the cam. This sequence does not depend on the direction in which the cam is shifted. Exception: The sequence described above may briefly generate an inverse cam if the new cam start is greater than the old cam end.
  • Page 114: Perform "Fast Cam Parameter Change

    Settings 10.6 Perform "Fast Cam Parameter Change" 10.6 Perform "Fast Cam Parameter Change" Definition The "Fast cam parameter change" setting can be used to modify a group of up to 16 cams while the system is in RUN. Requirement The cams you want to modify must be valid. Programming steps 1.
  • Page 115 Settings 10.6 Perform "Fast Cam Parameter Change" Address Name Type Start Comment value relative +1.6 EFFDIR_M BOOL FALSE 1 = negative effective direction (minus) +2.0 CBEGIN DINT New cam start +6.0 CEND DINT New cam end / new activation time +10.0 LTIME New lead time...
  • Page 116: Executing "Length Measurement And Edge Detection

    Settings 10.7 Executing "Length measurement and edge detection" 10.7 Executing "Length measurement and edge detection" Definition The "length measurement" and "edge detection" let you determine the length of a part. Length measurement and edge detection are active and remain active until you disable these functions or select a different measuring method.
  • Page 117 Settings 10.7 Executing "Length measurement and edge detection" If the setting is disabled during a length measurement, the FM 352 does not update the data. The MSR_DONE parameter remains reset. Edge detection 1. Enter a value for the minimum edge distance in the parameter DB. Write and enable machine data.
  • Page 118 Settings 10.7 Executing "Length measurement and edge detection" Data used in the parameter DB Address Name Type Start Comment value EDGEDIST DINT Minimum edge distance for edge detection Range: 0 ... 1 000 000 000 µm The minimum edge distance is used to define a range after the start of a measurement is detected with an edge detection.
  • Page 119 Settings 10.7 Executing "Length measurement and edge detection" Shift of the coordinate system during a length measurement Conditions under which a shift of the coordinate system will influence the measured length: ● You are using an incremental encoder or an initiator or are operating the FM 352 in simulation mode.
  • Page 120: Retrigger Reference Point

    Settings 10.8 Retrigger reference point 10.8 Retrigger reference point Definition The "Retrigger reference point" setting can be used to synchronize the axis as a reaction to a recurring external event. The setting remains active until you deactivate it. Requirements ● You are using an incremental encoder or an initiator. ●...
  • Page 121 Settings 10.8 Retrigger reference point Data used in the channel DB Address Name Type Start value Comment 34.3 REFTR_ON BOOL FALSE 1 = retrigger reference point 25.0 SYNC BOOL FALSE 1 = axis is synchronized Data used in the parameter DB Address Name Type...
  • Page 122 Settings 10.8 Retrigger reference point Example Rules for the example: ● The module evaluates the positive edges of the reference point switch and zero mark signals (axis moving in positive direction). ● Value of the reference point coordinate = 300 mm. ●...
  • Page 123 Settings 10.8 Retrigger reference point Inclusion of a zero offset Any active zero offset is included in the retrigger reference point setting. The reference point coordinate setting is thus calculated according to the formula: Ref = Ref - Zero offset is the value of the reference point coordinate store in machine data.
  • Page 124: Disabling Software Limit Switches

    Settings 10.9 Disabling software limit switches 10.9 Disabling software limit switches Definition Use the "Disable software limit switches" function to disable monitoring of the software limit switches at a linear axis. The setting remains active until you deactivate it. This re-enables the originally assigned software limit switches.
  • Page 125 Settings 10.9 Disabling software limit switches Effects of the setting ● simulation – Simulation mode stops when the axis passes a software limit switch. – You can resume simulation mode by enabling software limit switch monitoring. The axis moves in the defined direction. ●...
  • Page 126: Simulating

    Settings 10.10 Simulating 10.10 Simulating Definition The "Simulation" setting allows you to activate the cam controller with open encoder connections. Programming steps 1. Set the simulation velocity at the parameter DB. 2. Write and enable machine data. 3. Set either a positive or negative simulation direction at the channel DB. 4.
  • Page 127 Settings 10.10 Simulating Effects when simulation mode is deactivated ● Cam processing will be disabled. ● The synchronization of an incremental encoder or initiator will be cleared. The actual value will be reset to the value of the reference point coordinate. ●...
  • Page 128: Read "Count Values Of Counter Cam Tracks

    Settings 10.11 Read "count values of counter cam tracks" 10.11 Read "count values of counter cam tracks" Definition The "count values of counter cam tracks" is used to read the actual count values. Programming steps 1. Specify the counter cam tracks and the high count values in the machine data. 2.
  • Page 129 Settings 10.11 Read "count values of counter cam tracks" Data used in the parameter DB Address Name Type Start Comment value 99.0 SPEC_TRC0 BOOL FALSE 1 = track 0 is counter cam track 99.1 SPEC_TRC1 BOOL FALSE 1 = track 1 is counter cam track 100.0 CNT_LIM0 DINT...
  • Page 130: Read "Position And Track Data

    Settings 10.12 Read "position and track data" 10.12 Read "position and track data" Definition The "position and track data" function can be used to read the actual position value, the velocity, and the track identifier bits. The track identifier bits are recorded before being logically linked to machine and channel data.
  • Page 131: Read Encoder Data

    Settings 10.13 Read encoder data 10.13 Read encoder data Definition The "encoder data" setting an be used to read actual encoder data, and the value for absolute encoder adjustment. Requirements The value for absolute encoder adjustment can be read after "set reference point" is configured (see chapter "Determining the correct absolute encoder adjustment (Page 82)").
  • Page 132: Read Cam And Track Data

    Settings 10.14 Read cam and track data 10.14 Read cam and track data Definition The "cam and track data" setting can be used to read the actual cam / track identifier bits and the position. The track identifier bits are recorded before being logically linked to machine and channel data.
  • Page 133: Setting Control Signals For The Cam Controller

    Settings 10.15 Setting control signals for the cam controller 10.15 Setting control signals for the cam controller Definition The "control signals for the cam controller" setting can be used to enable cam processing and the tracks. Programming steps 1. Set the required bits at the channel DB. 2.
  • Page 134: Querying Checkback Signals For The Cam Controller

    Settings 10.16 Querying checkback signals for the cam controller 10.16 Querying checkback signals for the cam controller Definition The "checkback signals for the cam controller" setting informs you about the current state of the cam control and track signals. Consistency between the reported position and track signals is not guaranteed.
  • Page 135: Setting The Return Signals For Diagnostics

    Settings 10.17 Setting the return signals for diagnostics 10.17 Setting the return signals for diagnostics Programming steps The module sets the DIAG bit in the checkback interface each time it writes a new entry to the diagnostics buffer. Error events belonging to any of the error classes listed in Appendix "Data blocks / error lists (Page 177)"...
  • Page 136 Settings 10.17 Setting the return signals for diagnostics FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 137: Encoders

    Encoders 11.1 Incremental encoders Connectable incremental encoders The module supports incremental encoders outputting two pulses with 90° phase shift, and with or without zero mark signal: ● Encoders with asymmetrical 24 V output signals – Limit frequency = 50 kHz –...
  • Page 138 Encoders 11.1 Incremental encoders Signal shapes The diagram below shows the signal shapes of encoders with asymmetrical and symmetrical output signals. Figure 11-1 Signal shapes of incremental encoders Signal evaluation Increments An increment identifies a signal period of the encoders signals A and B. This value is specified in the technical data and/or on the rating plate of the encoder.
  • Page 139 Encoders 11.1 Incremental encoders Pulses The FM 352 evaluates all 4 edges of the A and B signals (see diagram) in each increment (quadruple evaluation). 1 increment (encoder default) = 4 pulses (FM evaluation) Reaction times The FM 352 has the following reaction times for connected incremental encoders: Minimum reaction time = cam cycle time + switching time of the connected switching elements Maximum reaction time = 2 x cam cycle time + switching time of the connected switching...
  • Page 140: Proximity Switches

    Encoders 11.2 Proximity switches 11.2 Proximity switches Definition Initiators are simple switches which output pulse-shaped signals, and do not return a directional signal. You define the direction based on the machine data for selecting the initiator. CAUTION Risk of material damage! Incorrect direction settings can cause serious errors in the system (for example, faulty control of a unit of equipment).
  • Page 141: Absolute Encoder

    Encoders 11.3 Absolute encoder 11.3 Absolute encoder Single-turn and multiturn encoders Absolute encoders are divided into the categories: ● Single-turn encoder The total range of single-turn encoders is scale to one revolution. ● Multiturn encoder The total range of multiturn encoders is scaled to several revolutions. Supported absolute encoders Absolute encoders with serial interface.
  • Page 142 Encoders 11.3 Absolute encoder Listen in "Listen in" means: an absolute encoder is operated in parallel on two modules (for example, FM 351 and FM 352). The FM 351 positioning module is the master and the clocks the absolute encoder, and the FM 352 electronic cam controller is the slave and listens in to the signals of the SSI frame.
  • Page 143 Encoders 11.3 Absolute encoder Reaction times With absolute encoders, the FM 352 has the following reaction times: Minimum reaction time = frame run time + cam cycle time + switching time of the connected switching elements Maximum reaction time = 2 x frame run time + monoflop time + 2 x cam cycle time + switching time of the connected switching elements With programmable absolute encoders: Maximum reaction time = frame run time + monoflop time + 2 x cam cycle time + switching...
  • Page 144 Encoders 11.3 Absolute encoder Example of Reaction Times The following example shows how to calculate the minimum and maximum reaction time. In the example a programmable encoder is not used. ● Cam cycle time: approx. 20 µs for max. 16 cams ●...
  • Page 145: Diagnostics

    Diagnostics 12.1 Possibilities for error evaluation Overview ● With the programming device/PC, you can read out the diagnostic buffer with the parameter assignment user interface using Test > Error Evaluation. – You will see the error class and error number along with plain text. ●...
  • Page 146: Meaning Of The Error Leds

    Diagnostics 12.2 Meaning of the error LEDs 12.2 Meaning of the error LEDs Display The status and error display indicate various error states. The LED is lit, even with errors that occur briefly, for at least 3 seconds. Figure 12-1 Status and error displays of FM 352 Display Meaning...
  • Page 147: Diagnostic Interrupts

    Diagnostics 12.3 Diagnostic interrupts 12.3 Diagnostic interrupts 12.3.1 Enable diagnostic interrupts Interrupt processing The FM 352 can trigger hardware and diagnostic interrupts. Process those interrupts in an interrupt OB. If an interrupt is triggered and the corresponding OB is not loaded, the CPU Programming with STEP 7 goes to STOP mode (refer to the Manual).
  • Page 148: Reaction Of Fm 352 To Errors With Diagnostics Interrupt

    Diagnostics 12.3 Diagnostic interrupts 12.3.2 Reaction of FM 352 to errors with diagnostics interrupt Reactions ● Cam processing will be disabled. ● The synchronization will be cleared by the following diagnostic interrupts: – Front connector missing, external power supply missing –...
  • Page 149 Diagnostics 12.3 Diagnostic interrupts Diagnostic interrupt control by CPU states ● Diagnostic interrupts are blocked by the FM 352 when the CPU is in STOP mode. ● If none of the queued errors were cleared while the CPU was in STOP, the FM 352 reports all these errors as "incoming"...
  • Page 150 Diagnostics 12.3 Diagnostic interrupts FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 151: Examples

    Examples 13.1 Introduction Example project folder The FM 352/FM 452 software package you installed contains example projects showing you several typical applications based on a number of selected functions. The English example project for the FM 352 is in the following folder: ...\STEP7\EXAMPLES\zEn19_02 This folder contains several S7 programs of varying complexity and objectives.
  • Page 152: Requirements

    Examples 13.2 Requirements 13.2 Requirements Overview The following requirements must be met: ● You have installed and wired an S7 station, consisting of a power supply module, a CPU and an FM 352 module (version ≥V5). The characteristics of earlier module versions may deviate from the description.
  • Page 153: Preparing The Examples

    5. Assign parameters for the FM 352 in HW Config using the instructions provided in the SIMATIC Function Modules FM 352 - First Steps in Commissioning, section FM 352 parameter assignment (http://support.automation.siemens.com/WW/view/en/1407842). 6. Enter the module address in the associated channel DB and, if necessary, also in the corresponding diagnostic DB in the "MOD_ADDR"...
  • Page 154: Testing The Example

    Examples 13.5 Testing the example 13.5 Testing the example Procedure After you have successfully completed all necessary entries, download the entire block folder to the CPU. The example programs include variable tables (VATs) you can use to view and change data blocks online (i.e., in CPU RUN mode).
  • Page 155: Sample Program 1 "Getting Started

    Examples 13.7 Sample program 1 "Getting Started" 13.7 Sample program 1 "Getting Started" Objective In this example, you commission your cam controller after you have assigned its parameters in the parameter assignment interface according to the "Getting Started" manual. The example extends the program shown in the "Integration in the User Program" chapter of the getting started by adding error evaluation.
  • Page 156: Sample Program 2 "Commissioning

    Examples 13.8 Sample Program 2 "Commissioning" 13.8 Sample Program 2 "Commissioning" Objective In this sample, you commission a cam controller without using the programming interface. You control and monitor the system using the variable tables (VATs). Requirements You have assigned the cam controller parameters as described in the "Getting Started" Manual.
  • Page 157: Sample Program 3 "One Module

    Examples 13.9 Sample program 3 "One Module" 13.9 Sample program 3 "One Module" Objective In this example, you control a cam controller in a user program. The user program commissions the module after a CPU restart. Next, it executes a step sequence that is triggered by certain events.
  • Page 158 Examples 13.9 Sample program 3 "One Module" Operation The CPU is in STOP. 1. Open variable table VAT1, then transfer the control values. 2. Restart the CPU (STOP > RUN). You can see how the actual position (CAM.ACT_POS), the cam data (CAM.CAM_00_31) and the track signals (CAM.TRACK_OUT) change. You should also observe the step number of the step sequence (PROGDB.STEPNO).
  • Page 159 Examples 13.9 Sample program 3 "One Module" Step 3: Cams 0 and 1 receive new parameters. To let you view the change, the cam data are read before and after the change and indicated at VAT1. Step 4: The program waits for the set jobs to be executed. Step 5: The program waits for the "external"...
  • Page 160: Sample Program 4 "Interrupts

    Examples 13.10 Sample program 4 "Interrupts" 13.10 Sample program 4 "Interrupts" Objective This sample contains a user program with the same task as in sample program 3 "One Module". In this sample, you are shown how to evaluate a diagnostic interrupt for specific modules, and how to process this in the user program to produce a general module error.
  • Page 161 Examples 13.10 Sample program 4 "Interrupts" User program (FB PROG) The task is the same as in sample program 3 "One Module". However, the block was expanded by adding evaluation of the diagnostics event. In this sample, no special measures have been taken for restarting after eliminating the error.
  • Page 162: Sample Program 5 "Multimodules

    Examples 13.11 Sample program 5 "MultiModules" 13.11 Sample program 5 "MultiModules" Objective This sample contains the same user program as sample program 3 "One Module", but this time it is used to operate two modules with different cam parameters. The user program uses an own instance of CAM_CTRL and CAM_DIAG for each module, a multiple instance is not possible.
  • Page 163 Examples 13.11 Sample program 5 "MultiModules" User program (FB PROG) The objective and sequence of the user program are as in sample program 4 "Interrupts" and sample program 3 "One Module". The user program is designed for the operation of more than one module, since it accesses the module-specific data blocks: channel DB, diagnostic DB, and parameter DB.
  • Page 164 Examples 13.11 Sample program 5 "MultiModules" FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...
  • Page 165: Technical Data

    Technical data General technical data The following technical data are available in the Operating Instructions SIMATIC S7-300 CPU 31xC and CPU 31x: Installation (http://support.automation.siemens.com/WW/view/en/13008499). ● Standards and licenses ● Electromagnetic compatibility ● Transport and storage conditions ● Mechanical and climatic environmental conditions ●...
  • Page 166: Technical Data

    M (X1, terminal 2) and the central grounding point (shield): 60 V AC; 75 V DC Insulation test voltage: 500 V DC  Encoder supply Horizontal installation of S7-300, 20 °C:  – 5.2 V/300 mA – 24 V/300 mA Horizontal installation of S7-300, 60 °C:...
  • Page 167: A.2 Technical Data

    Technical data A.2 Technical data Encoder inputs Position detection Incremental  Absolute  Signal voltages Symmetrical inputs: 5 V in accordance with RS 422  Asymmetrical inputs: 24 V/ typically 9 mA Input frequency and cable length for symmetrical max. 1 MHz with 32 m shielded cable length incremental encoders with 5 V supply Input frequency and cable length for symmetrical max.
  • Page 168  inductive load: max. 0.5 Hz  Cumulative current of digital outputs with horizontal Demand factor 100%: installation of S7-300 at 20 °C: 6 A  at 60 °C: 3 A  Cumulative current of digital outputs with vertical installation...
  • Page 169: Connection Diagrams

    Encoder type Connecting cable Comment Incremental encoder 4 x 2 x 0.25 + 2 x 1 mm Incremental encoder: Siemens =5 V, RS422 6FX 2001-2⃞⃞⃞⃞ Incremental encoder 4 x 2 x 0.5 mm Incremental encoder: Siemens =24 V, RS422 6FX 2001-2⃞⃞⃞⃞...
  • Page 170: Connection Diagram For Incremental Encoder Siemens 6Fx 2001-2 (Up=5V; Rs 422)

    Connection Diagrams B.2 Connection Diagram for Incremental Encoder Siemens 6FX 2001-2 (Up=5V; RS 422) Connection Diagram for Incremental Encoder Siemens 6FX 2001-2 (Up=5V; RS 422) Connection diagram Figure B-1 Connection diagram for incremental encoder Siemens 6FX 2001-2⃞⃞⃞⃞ (Up=5 V: RS422)
  • Page 171: B.2 Connection Diagram For Incremental Encoder Siemens 6Fx 2001-2 (Up=5V; Rs 422)

    Connection Diagrams B.2 Connection Diagram for Incremental Encoder Siemens 6FX 2001-2 (Up=5V; RS 422) Sub D connector 15-pin sub D connector, metallized housing with screw interlock 6FC9 341-1HC Figure B-3 Sub D connector, terminal end (solder side) FM 352 electronic cam controller...
  • Page 172: Connection Diagram For Incremental Encoder Siemens 6Fx 2001-2 (Up=24V; Rs 422)

    Connection Diagrams B.3 Connection Diagram for Incremental Encoder Siemens 6FX 2001-2 (Up=24V; RS 422) Connection Diagram for Incremental Encoder Siemens 6FX 2001-2 (Up=24V; RS 422) Connection diagram Figure B-4 Connection diagram for incremental encoder Siemens 6FX 2001-2⃞⃞⃞⃞ (Up=24V; RS422) Circular connector...
  • Page 173: B.3 Connection Diagram For Incremental Encoder Siemens 6Fx 2001-2 (Up=24V; Rs 422)

    Connection Diagrams B.3 Connection Diagram for Incremental Encoder Siemens 6FX 2001-2 (Up=24V; RS 422) Sub D connector 15-pin sub D connector, metallized housing with screw interlock 6FC9 341-1HC Figure B-6 Sub D connector, terminal end (solder side) FM 352 electronic cam controller...
  • Page 174: Wiring Diagram Of The Incremental Encoder Siemens 6Fx 2001-4 (Up = 24 V; Htl)

    Connection Diagrams B.4 Wiring Diagram of the Incremental Encoder Siemens 6FX 2001-4 (Up = 24 V; HTL) Wiring Diagram of the Incremental Encoder Siemens 6FX 2001-4 (Up = 24 V; HTL) Connection diagram Figure B-7 Connection diagram for incremental encoder Siemens 6FX 2001-4⃞⃞⃞⃞ (Up=24V;...
  • Page 175: B.4 Wiring Diagram Of The Incremental Encoder Siemens 6Fx 2001-4 (Up = 24 V; Htl)

    Connection Diagrams B.4 Wiring Diagram of the Incremental Encoder Siemens 6FX 2001-4 (Up = 24 V; HTL) Sub D connector 15-pin sub D connector, metallized housing with screw interlock 6FC9 341-1HC Figure B-9 Sub D connector, terminal end (solder side)
  • Page 176: Connection Diagram For Absolute Encoder Siemens 6Fx 2001-5 (Up=24V; Ssi)

    Connection Diagrams B.5 Connection Diagram for Absolute Encoder Siemens 6FX 2001-5 (Up=24V; SSI) Connection Diagram for Absolute Encoder Siemens 6FX 2001-5 (Up=24V; SSI) Connection diagram Figure B-10 Connection diagram for absolute encoder Siemens 6FX 2001-5⃞⃞⃞⃞ (Up=24V; SSI) Circular connector 12-pin Siemens socket 6FX2003-0SU12...
  • Page 177: Data Blocks / Error Lists

    Data blocks / error lists Content of the channel DB Note Do not modify any data not listed in this table. Content of the channel DB Address Name Type Initial value Comment Addresses/ version switch MOD_ADDR (enter!) Module address CH_NO Channel number (always 1) 10.0 PARADBNO...
  • Page 178: C.1 Content Of The Channel Db

    Data blocks / error lists C.1 Content of the channel DB Address Name Type Initial value Comment 25.0 SYNC BOOL FALSE 1 = axis is synchronized 25.1 MSR_DONE BOOL FALSE 1 = length measurement or edge detection completed 25.2 GO_M BOOL FALSE 1 = axis moving in negative direction...
  • Page 179 Data blocks / error lists C.1 Content of the channel DB Address Name Type Initial value Comment 36.0 CAM6WR_EN BOOL FALSE 1 = write cam data 6 (cams 80 to 95) 36.1 CAM7WR_EN BOOL FALSE 1 = write cam data 7 (cams 96 to 111) 36.2 CAM8WR_EN...
  • Page 180 Data blocks / error lists C.1 Content of the channel DB Address Name Type Initial value Comment Done bits for function switches 40.0 EDGE_D BOOL FALSE 1 = "activate edge detection" or "deactivate edge detection" completed 40.1 SIM_D BOOL FALSE 1 = "activate simulation"...
  • Page 181 Data blocks / error lists C.1 Content of the channel DB Address Name Type Initial value Comment Done bits for read jobs 43.1 MDRD_D BOOL FALSE 1 = "read machine data" job completed 43.2 CAM1RD_D BOOL FALSE 1 = "read cam data 1" job completed 43.3 CAM2RD_D BOOL...
  • Page 182 Data blocks / error lists C.1 Content of the channel DB Address Name Type Initial value Comment 48.0 CAM6WR_ERR BOOL FALSE 1 = error in "Write cam data 6" job 48.1 CAM7WR_ERR BOOL FALSE 1 = error in "Write cam data 7" job 48.2 CAM8WR_ERR BOOL...
  • Page 183 Data blocks / error lists C.1 Content of the channel DB Address Name Type Initial value Comment Data for "Change cam edges" job 102.0 CAM_NO Cam number 104.0 CAM_START DINT Cam start 108.0 CAM_END DINT Cam end Data for "Length measurement/edge detection" job 112.0 BEG_VAL DINT...
  • Page 184 Data blocks / error lists C.1 Content of the channel DB Address Name Type Initial value Comment Relative address +0.0 CAM_NO BYTE B#16#0 Number of the cam to modify +1.0 C_EFFDIR BOOL FALSE 1 = change the effective direction +1.1 C_CBEGIN BOOL FALSE...
  • Page 185: Content Of The Parameter Db

    Data blocks / error lists C.2 Content of the parameter DB Content of the parameter DB Note Do not modify any data not listed in this table. Content of the Parameter DB Address Name Type Start value Comment Machine data PI_MEND BOOL FALSE...
  • Page 186: C.2 Content Of The Parameter Db

    Data blocks / error lists C.2 Content of the parameter DB Address Name Type Start value Comment 95.0 EN_IN_I3 BOOL FALSE Enable input I3 95.1 EN_IN_I4 BOOL FALSE 0 for FM 352 95.2 EN_IN_I5 BOOL FALSE 0 for FM 352 95.3 EN_IN_I6 BOOL...
  • Page 187: Data And Structure Of The Diagnostic Db

    Data blocks / error lists C.3 Data and Structure of the Diagnostic DB Data and Structure of the Diagnostic DB Note Do not modify any data not listed in this table. Content of the diagnostic DB Table C- 1 Structure of the diagnostic DB Address Name Type...
  • Page 188: C.3 Data And Structure Of The Diagnostic Db

    Data blocks / error lists C.3 Data and Structure of the Diagnostic DB Structure of the Diagnostic Entry The diagnostic entry DIAG[n] is structured as follows: Table C- 2 Structure of the diagnostic entry DIAG[n] Address Name Type Start value Comment +0.0 STATE...
  • Page 189 Data blocks / error lists C.3 Data and Structure of the Diagnostic DB JOB_ERR JOB_ERR JOB_ERR Meaning (hex) (dec) (int) 80C4 32964 -32572 Communication errors 80C5 32965 -32571 Distributed I/Os not available. 80C6 32966 -32570 Priority class abort (restart or background) 8522 34082 -31454...
  • Page 190: Error Classes

    Data blocks / error lists C.4 Error classes Error classes Class 1: Operating error Operating errors are detected asynchronously to an operator input/control. Meaning Diagnostic interrupt Software limit switch start passed Software limit switch end passed Traversing range start passed Traversing range end passed Set actual value on-the-fly cannot be executed Cause...
  • Page 191: C.4 Error Classes

    Data blocks / error lists C.4 Error classes Meaning Diagnostic interrupt Enable machine data not permitted Cause There are no new (error-free) machine data on the module Set actual value on-the-fly not permitted Cause An attempt was made to execute "set actual value on-the-fly" while "retrigger reference point"...
  • Page 192 Data blocks / error lists C.4 Error classes Meaning Diagnostic interrupt Incorrect actual value specified by "set actual value" / "set actual value on-the- fly" Cause The specified actual value is outside the permitted numeric range of ±100 m or ±1000 m. When this setting is applied, the software limit switches would be outside the traversing range (-100 m to +100 m or -1000 m to +1000 m).
  • Page 193 Data blocks / error lists C.4 Error classes Meaning Diagnostic interrupt Incorrect distance/encoder revolution Cause The value for distance/encoder revolution is outside the permitted range of 1 to 10 µm (regardless of the resolution). Incorrect number of increments/encoder revolution (see chapter "Machine data of the encoder (Page 86)") Incorrect number of increments/encoder revolution (see chapter "Machine data of the encoder (Page 86)")
  • Page 194 Data blocks / error lists C.4 Error classes Meaning Diagnostic interrupt Incorrect number of cams Cause You have specified a value other than 0 to 3 for the number of cams. Incorrect hysteresis Cause The hysteresis is outside the range 0 to 65535 * resolution. The hysteresis is greater than [¼...
  • Page 195 Data blocks / error lists C.4 Error classes Class 7: Cam data error The diagnostic interrupt is only triggered if an error is detected in the system data block (SDB). Meaning Diagnostic interrupt Illegal hardware interrupt Cause You attempted to define a hardware interrupt for a cam with a cam number >...
  • Page 196 Data blocks / error lists C.4 Error classes Class 15: Messages Meaning Diagnostic interrupt Start of parameter assignment Cause The module has detected a parameter assignment via a system data block. End of parameter assignment Cause The module has processed the parameter assignment via a system data block error-free.
  • Page 197 Data blocks / error lists C.4 Error classes Meaning Diagnostic interrupt Internal module power supply failed Cause Error in the FM 352 Effect Module is reset  Provided that after resetting the module, no module  defect is detected, the module is ready for operation again.
  • Page 198 Data blocks / error lists C.4 Error classes Meaning Diagnostic interrupt Absolute encoder frame error Cause The frame traffic between FM 352 and the absolute encoder (SSI) is incorrect or interrupted: Encoder cable cut or not plugged in  Incorrect encoder type ...
  • Page 199: D Programming Without Sfb 52 And Sfb 53

    Programming without SFB 52 and SFB 53 Overview of the Programming without SFB 52 and SFB 53 section If your CPU does not support the system blocks SFB 52 and SFB 53 with DPV1 functionality Then use the blocks from the program folder "FM 352,452 CAM V1" to program the FM 352. You will find a description in this section.
  • Page 200: Basics Of Programming An Fm 352

    Programming without SFB 52 and SFB 53 D.2 Basics of Programming an FM 352 Basics of Programming an FM 352 Task You can assign parameters, control, and commission the FM 352 module via a user program. To exchange data between the user program and module, you use the functions (FCs) and data blocks (DBs) described below.
  • Page 201: Fc Cam_Init (Fc 0)

    Programming without SFB 52 and SFB 53 D.3 FC CAM_INIT (FC 0) FC CAM_INIT (FC 0) Tasks FC CAM_INIT initializes the following data in the channel DB: ● The control signals ● The checkback signals ● The trigger, done and error bits of the jobs ●...
  • Page 202: Fc Cam_Ctrl (Fc 1)

    Programming without SFB 52 and SFB 53 D.4 FC CAM_CTRL (FC 1) FC CAM_CTRL (FC 1) Tasks You can use FC CAM_CTRL to read operating data from the module, initialize the module, and control it during operation. For these tasks, you use the control signals, checkback signals, and write and read jobs.
  • Page 203: D.4 Fc Cam_Ctrl (Fc 1)

    Programming without SFB 52 and SFB 53 D.4 FC CAM_CTRL (FC 1) Jobs Data exchange with the module other than the control and checkback signals is handled by using jobs. To start a job, set the corresponding trigger bit in the channel DB and provide the relevant data for write jobs.
  • Page 204 Programming without SFB 52 and SFB 53 D.4 FC CAM_CTRL (FC 1) Call parameters Name Data type P-type Meaning DB_NO Number of the channel DB RET_VAL Return value Return values The function provides the following return values: RET_VAL Description At least 1 job active No job active, no error Error: Data error (DAT_ERR) or...
  • Page 205 Programming without SFB 52 and SFB 53 D.4 FC CAM_CTRL (FC 1) Reaction to errors If faulty data were written by a write job, the module returns the message DATA_ERR = 1. If an error occurs during communication with the module for a write or read job, the cause of the error is entered in the JOB_ERR parameter in the channel DB.
  • Page 206: Fc Cam_Diag (Fc 2)

    Programming without SFB 52 and SFB 53 D.5 FC CAM_DIAG (FC 2) FC CAM_DIAG (FC 2) Tasks Use FC CAM_DIAG to read the data of the diagnostic buffer of the module and make these available for visualization on an operator control and monitoring system or for a programmed evaluation.
  • Page 207: D.5 Fc Cam_Diag (Fc 2)

    Programming without SFB 52 and SFB 53 D.5 FC CAM_DIAG (FC 2) Return values The function returns the following return values: RET_VAL Description Job active No job active, no error Error Reaction to errors The cause of a job error can be read in the JOB_ERR parameter of the diagnostic DB (see chapter "Possibilities for error evaluation (Page 145)").
  • Page 208: Data Blocks

    Programming without SFB 52 and SFB 53 D.6 Data blocks Data blocks D.6.1 Templates for data blocks The included library (FMx52LIB) contains a block template (UDT) for each data block. Based on this UDT, you can create data blocks with user-specific numbers and names. Optimizing the UDT To save memory, you can delete unused data areas at the end of the UDT CAM_CHANTYPE.
  • Page 209: Diagnostics Db

    Programming without SFB 52 and SFB 53 D.6 Data blocks D.6.3 Diagnostics DB Task The diagnostic DB provides the data storage for FC CAM_DIAG and contains the diagnostic buffer of the module prepared by this function. Configuration Diagnostic DB Module address Internal data Job status Trigger bit...
  • Page 210: Parameter Db

    Programming without SFB 52 and SFB 53 D.6 Data blocks D.6.4 Parameter DB Task All machine and cam data are stored in the parameter DB. These parameters can be modified by the user program or by an operator control and monitoring system. The modified data can be imported to the parameter assignment interface and displayed there.
  • Page 211: Interrupts

    Programming without SFB 52 and SFB 53 D.7 Interrupts Interrupts Interrupt processing The FM 352 can trigger hardware and diagnostic interrupts. You process those interrupts in an interrupt OB. If an interrupt is triggered and the corresponding OB is not loaded, the CPU Programming with STEP 7 goes to STOP mode (refer to the Manual).
  • Page 212: Evaluation Of A Hardware Interrupt

    Programming without SFB 52 and SFB 53 D.8 Evaluation of a hardware interrupt Evaluation of a hardware interrupt If FM 352 triggers a hardware interrupt, the following information is available in the OB40_POINT_ADDR variable (or in the corresponding variable of a different hardware interrupt OB): Table D- 1 Content of double word OB40_POINT_ADDR...
  • Page 213: Evaluating A Diagnostics Interrupt

    Programming without SFB 52 and SFB 53 D.9 Evaluating a diagnostics interrupt Evaluating a diagnostics interrupt Following a diagnostic interrupt, the diagnostic information is available in the variables of OB82 and can be used for a fast analysis. Call FC CAM_DIAG to find out the exact cause of the error by reading the diagnostic buffer.
  • Page 214: Technical Specifications

    Programming without SFB 52 and SFB 53 D.10 Technical specifications D.10 Technical specifications Overview The table below provides an overview of the technical data of the FM 352 functions. Table D- 2 Technical data of FM 352 functions Block name Version Allocation Allocation in...
  • Page 215: Fast Access To Module Data

    Programming without SFB 52 and SFB 53 D.11 Fast access to module data D.11 Fast access to module data Application Very fast access to checkback and control signals is required in special applications or in an alarm level. You can access these data directly via the input and output areas of the module. To coordinate startup following each module startup (for example, after inserting a module, CPU STOP →...
  • Page 216: D.11 Fast Access To Module Data

    Programming without SFB 52 and SFB 53 D.11 Fast access to module data Writing control signals via direct access The byte addresses are specified relative to the input address of the module. The bit names correspond to the names in the channel DB. In STL, you access the data using the PQB (write 1 byte) and PQW (write 2 bytes) commands.
  • Page 217: Parameter Transfer Routes

    Programming without SFB 52 and SFB 53 D.12 Parameter transfer routes D.12 Parameter transfer routes Transmission paths The term parameter refers to the following machine and cam data. Figure D-1 Parameter transmission paths Save the parameters in the parameter assignment interface. Save and compile the HW configuration and download it to the CPU.
  • Page 218: D.12 Parameter Transfer Routes

    Programming without SFB 52 and SFB 53 D.12 Parameter transfer routes Some use cases for the transfer of parameters Use case Steps You edit the parameters on the parameter assignment interface. Perform steps 1, 2, and 3. The parameters should then be assigned automatically to the module during startup.
  • Page 219: Index

    Index C_CBEGIN, 114 C_CEND, 114 Absolute encoder, 76, 141 C_EFFDIR, 114 Data transfer, 141 C_LTIME, 114 Frame run time, 143 C_QTY, 94, 114 Monoflop time, 143 Cable length Pulse evaluation, 141 Maximum, 89 Reaction times, 143 Absolute encoder (SSI), 78 Direction-based, 16 Absolute encoder adjustment, 69 Inverse, 17...
  • Page 220 Index CAMVALID, 98 Data element for set reference point job, 182 Cancel set actual value, 104 Data element for zero offset job, 182 AVALREM_EN, 106 Data error, 190 Canceling the setting Data for change cam edges job, 183 Cancel set actual value, 106 Data for fast cam parameter change job, 183 CBEGIN, 99, 100, 115 Data for length measurement/edge detection job, 183...
  • Page 221 Index FB CAM_CTRL Call, 43 Edge distance Data used, 43 Deactivating, 115 Error behavior, 46 EDGEDIST, 81 Return values, 45 EFFDIR_M, 98, 115 Tasks, 43 EFFDIR_P, 98, 114 FB CAM_DIAG Effective direction, 15, 97, 98 Call, 47 Electronic cam controller, 13 Data used, 47 EN_IN_I3, 95 Error behavior, 48...
  • Page 222 Index Function switches, 44, 58, 178, 203, 217 Functions, 40, 58, 200, 217 Execution times, 58, 217 execute, 58 Technical specifications, 58, 214, 217 Executing, 217 FVAL, 105 Job management for FB CAM_CTRL, 182 FVAL_DONE, 105 Job status, 45, 58, 204, 217 FVAL_EN, 105 Jobs, 44, 58, 203, 217 Getting prepared for programming, 64...
  • Page 223 Index Machine data error, 192 Machine data of the encoder Packaging unit, 12 Data in the parameter DB, 86 Parameter assignment Definition, 86 Position-/time-based cams, 15 Maximum cable length, 89 Parameter assignment interface, 37, 63 MD_EN, 70 installing, 37 MDRD_EN, 70 Parameter DB, 185 MDWR_EN, 70 Areas, 51, 58, 210, 217...
  • Page 224 Index Symmetrical output signals, 138 SYNC, 110 Safety rule, 29 Synchronization Safety rules, 27 loss of, 109 Safety system, 13 System of units Safety-relevant limit switches, 62 in the parameter DB, 73 Scope of the manual, 7 Selecting, 73 Sequence when writing Machine and cam data, 67 Set actual value, 104, 106 Data in the channel DB, 105...
  • Page 225 Index UDT, 58, 217 Optimizing, 58, 217 Use case typical, 11 Velocity Dependency on the resolution, 93 Version switch, 177 Wire break, 90 Wire end ferrules, 34 Wiring encoders, 31 Working range, 78 Writing Cam data, 71 Machine data, 68 Zero offset Canceling, 109 Data used in the channel DB, 108...
  • Page 226 Index FM 352 electronic cam controller Operating Instructions, 05/2011, A5E01071724-03...

Table of Contents