Encoder Set

Embed Size (px)

Citation preview

  • 8/12/2019 Encoder Set

    1/8

    http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=27864874&c

    aller=view

    http://forums.mrplc.com/index.php?showtopic=9063 9799072074

    How do you determine the frequency of a pulse sequence and speeds?

    Display part number

    Description:

    The S7-200 provides the option of counting pulse trains using high-speed counters. Using the attached

    "Frequency" library,the frequency of the pulse train is calculated from the counter signal, from which the

    speed of stepper motors, for example, can be determined after relevant conversion.

    Overview:

    The task is split into the following 3 steps.

    1. Define a high-speed counter to capture the pulse train frequency

    2. Create the program code

    3. Convert the frequency determined into a speed

    1. Define a fast counter to capture the pulse train frequency

    First, using the STEP 7 Micro/WIN Instruction Wizard you must generate a high-speed counter that

    counts the external pulses.

    Table 01 shows which high-speed counters the S7-200 provides, which inputs these use and the

    maximum measurable frequency.

    High speed counters Clock input Max. input frequency CPUs

    HC0 E0.0 30 kHz 221, 222, 224, 224XP, 224XPsi, 226

    http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=27864874&caller=viewhttp://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=27864874&caller=viewhttp://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=27864874&caller=viewhttp://forums.mrplc.com/index.php?showtopic=9063http://forums.mrplc.com/index.php?showtopic=9063http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Downloadhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Downloadhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Z%C3%A4hler%20definierenhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Z%C3%A4hler%20definierenhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Programmcodehttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Programmcodehttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Drehzahlhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Drehzahlhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Drehzahlhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Programmcodehttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Z%C3%A4hler%20definierenhttp://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Downloadhttp://forums.mrplc.com/index.php?showtopic=9063http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=27864874&caller=viewhttp://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&objid=27864874&caller=view
  • 8/12/2019 Encoder Set

    2/8

    HC1 E0.6 30 kHz 221, 222, 224, 224XP, 224XPsi, 226

    HC2 E1.2 30 kHz 221, 222, 224, 224XP, 224XPsi, 226

    HC3 E0.1 30 kHz 221, 222, 224, 224XP, 224XPsi, 226

    HC4 E0.3 200 kHz 224XP, 224XPsi

    HC5 E0.4 200 kHz 224XP, 224XPsi

    Table 01

    Procedure:

    No. Description

    1 Open the Instruction Wizard via the "Tools" menu in STEP 7 Micro/WIN.

    Fig. 01

    2 There you select the high-speed counter "HSC" from the configuration catalog.

    Then click on "Next >".

  • 8/12/2019 Encoder Set

    3/8

    Fig. 02

    3 Leave the mode set to "0" for single-phase up/down counting and select a counter (e.g. "HC4").

    Fig. 03

    Note:

    Please refer toTable 01for selecting the high-speed counter.

    4 Leave the settings for the subprograms, counter presettings, counter value and counting direction.

    Click on "Next".

    http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Tabelle%2001http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Tabelle%2001http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Tabelle%2001http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Tabelle%2001
  • 8/12/2019 Encoder Set

    4/8

    Fig. 04

    5 In the next window, also leave the presetting,

    and do notset a check mark for "Interrupt on Current Value equal Preset Value (CV = PV)".

    Fig. 05

    6 Close the Instructions Wizard with the "Finish" button.

  • 8/12/2019 Encoder Set

    5/8

    Fig. 06

    Table 02

    2. Create the program code

    No. Description

    1 In network 1 of the operation block use the initialization bit SM0.1 to call the initialization block

    generated by the Instructions Wizard for the high-speed counter.

    Fig. 07

    2 In network 2 you cyclically call (SM0.0) the "Frequency" block from the library with the same name

    in the list.

  • 8/12/2019 Encoder Set

    6/8

    Fig. 08

    Enable the function via the connection of the "Active" input (when disabled, the "Hz" parameter

    outputs the value "0").

    Address the "Counter" with the counter selected with the Instructions Wizard.

    Address the IN-OUT parameter "Hz" with a free double-word (Format: REAL) for displaying the

    frequency measured in Hertz.

    The "Trigger" output provides a pulse signal for optional recording of the frequency characteristic

    via the Data Log function (seeStep 5).

    3 The "Frequency" library needs 16 bytes in the global variable memory. For this you specify an

    address via "File" -> "Library Memory Allocation...".

    Fig. 09

    4 Via the "Symbol Table" view you get to symbolic addressing of the "Frequency" library. The

    "Time_interval" symbol defines the measuring interval in seconds for the frequency calculation.

    http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Schritt%205http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Schritt%205http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Schritt%205http://support.automation.siemens.com/WW/llisapi.dll?func=ll&objid=27864874&nodeid0=10805397&caller=view&lang=en&siteid=cseus&aktprim=0&objaction=csopen&extranet=standard&viewreg=WW#Schritt%205
  • 8/12/2019 Encoder Set

    7/8

    The default setting is an interval time of 1 second, but you can change this.

    Fig. 10

    5 As an option, in network 3 of the sample project "Frequency", the Data Log function is

    incorporated for capturing the frequency time on a memory module. Via the AND operation of the

    "Active" and "Trigger" signals, when you activate the "Frequency" block, each frequency is

    recorded at the intervals of the "Time_interval" set.

    Fig. 11

    Note:

    The Data Log function is executed via the Data Log Wizard and the values recorded can be read

    out via the S7-200 Explorer.

    More information on the Data Log function is available in the SIMATIC S7-200 Video Tutorial

    (Entry ID:30839030).

    Table 03

    3. Convert the frequency determined into a speed

    Apply the following formula to obtain a speed:

    n = 60 * f / p

    n= Speed in minutes-1

    http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=30839030&objAction=csOpen&nodeid0=10805397&lang=en&siteid=cseus&aktprim=4&extranet=standard&viewreg=WWhttp://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=30839030&objAction=csOpen&nodeid0=10805397&lang=en&siteid=cseus&aktprim=4&extranet=standard&viewreg=WWhttp://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=30839030&objAction=csOpen&nodeid0=10805397&lang=en&siteid=cseus&aktprim=4&extranet=standard&viewreg=WWhttp://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=30839030&objAction=csOpen&nodeid0=10805397&lang=en&siteid=cseus&aktprim=4&extranet=standard&viewreg=WW
  • 8/12/2019 Encoder Set

    8/8

    f= Frequency in Hz

    p= Number of pulses required for one motor revolution