Sie sind auf Seite 1von 2

Siemens - Industry Automation and Drive Technologies - Service& Support - Automation...

Page 1 of 2
show the entry list Measuring impulse length with S7-200 Display part number QUESTION: How can I measure the exact length of an upcoming impulse with an S7-200? ANSWER: You can realize a recording of the length of upcoming impulses as described below. 1. Create a sub program for the pulse stretching modulation l Create a permanent 20 kHz impulse sequence with the help of the pulse release function PLS and the function PWM. This can be carried out by clicking on the menu "Extras > Positioning assistant". l Dial the function "Configure integrated PTO/PWM function of the S7 200". l Select the corresponding ouput which shall distribute the impulses and thus automatically the assigned impulse generator (in our example A0.0). l Select the function PWM and the necessary time base (time base micro seconds, cycle 50 s und 25 s impulses). l Then confirm the module of the sub program with "Finish". 2. Configuration of a high speed counter with the operation assistant "HSC". l Open the assistant by clicking on the menu "Extras > Operation assistant > HSC" for the high speed counter. l Select the corresponding high speed counter in the assistant (in our example HSC 1 mode 2). Indicate the initialization possibilities which apply for you.

Fig. 1: Operating assistant HSC1 ( 57 KB ) Close the assistant afterwards.

3. Inserting the sub programms or Interrupts into the project l Assign an Interrupt program (INT_0) to the event 1 (falling edge at E0.0) in the sub program SBR_0. l Copy the current counter value HC1 in this Interrupt program (INT_0) into a double word and then initialize the counter in order to set it to 0. 4. Realization of the hardware connections l Connect the output A0.0 (impulse generator) to the input of the high speed counter (in our example E0.6 for HSC1). l Put the impulse which should be messured (initiator) to the start input (E1.1 bei HSC1) and connect it with the interruptable input (E0.0). The 20 kHz of impulses are counted now, if the start input is active. l Put the entrance E1.0 (reset terminal HSC1) on mass to keep it from getting active. l The value of the high speed counter HSC1 is read out and filed in the already defined memory area (VD0) and the counter is then set to 0 again, at every falling edge of the entrance E0.0. l Calculate the exact length of the impulse according to the quoted impulse sequence calculation formula: Measurement of the upcoming impulse x 0.0005 s). l The factor 0.0005 corresponds 1/x of the impulse sequence 20000. The STEP 7 Micro/Win project as a download: The download contains all necessary subprogramms, Interrupts and calls for the program editing. The project was created with STEP 7 Micro/WIN V3.2.4.27.

http://support.automation.siemens.com/WW/llisapi.dll/16938211?func=ll&objId=169382... 10.09.2010

Siemens - Industry Automation and Drive Technologies - Service& Support - Automation... Page 2 of 2

S7200Pulse.exe ( 31 KB ) Copy the file "S7200Pulse.exe" to a separate directory and start the file through a double-click. The STEP 7 Micro/Win project will be unpacked automatically. The project can now be opened and edited with STEP7 Micro/WIN V3.2.4.27. An update for STEP 7 Micro/WIN V3.2 to the version 3.2.4.27 can be found at entry-ID16520047. Entry ID:16938211 Date:2003-09-10 I regard this article.... Copy link
Print Siemens AG 2010 - Corporate Information - Privacy Policy - Terms of Use

as helpful

as not helpful Send to a friend

Suggestion for the entry

http://support.automation.siemens.com/WW/llisapi.dll/16938211?func=ll&objId=169382... 10.09.2010