Vous êtes sur la page 1sur 5

30/11/2013

Siemens Industry Online Support - Automation Service, Automation Support, Simatic Service, Simatic Support, Technical Support, Technical Consult

Automation Technology > Automation Systems > Automation software > Software in TIA
Portal > Controller Software in TIA Portal > STEP 7 (TIA Portal)
STEP 7 (TIA Portal) -- Creating S7 programs -- Calling blocks and functions
In STEP 7 (TIA Portal), how can you read out diagnostics data of a hardware object with the
GET_DIAG instruction?
What are the block protection facilities available in STEP 7 to protect the the know-how of your
blocks?
Why is the "GET_NAME" instruction not executed in STEP 7 (TIA Portal) V12?
Why should whole structures instead of many single components be transferred for the S7-1500
when a block is called?
What differences should you watch out for between optimized data storage and the standard type
of block access in STEP 7 (TIA Portal) V12?
What types of access, value columns and operator input options are available for the global data
blocks in STEP 7 V12?
How do you program the TSEND_C and TRCV_C instructions for open user communication over
the integrated PROFINET interface of the S7-1200 CPU?
How do you program the TC_CONFIG instruction to change the parameters of a CP1242-7
configured in STEP 7?
How are the automatic PID controller settings (optimization) made for asymmetrical temperature
control paths in STEP 7 (TIA Portal) V11?
How do you change the pulse length for the pulse width modulation (PWM) in the user program of
the S7-1200 CPU?
How do you compile blocks with know-how protection in STEP 7 (TIA Portal) V11 when they have
been copied from another project?
Where can you download the F FBs for the Mobile Panel 277F IWLAN for the Safety option of
STEP 7 V5.5, STEP 7 Professional V11 and STEP 7 Professional V12?
Which organization blocks can you use in STEP 7 (TIA Portal)?
How in S TE P 7 V 11 do y ou s av e t he v alue of an " HS C" (high-s peed c ount er) f or t he
S 7-1200 af t er S TOP mode or af t er a res t art ?
Which Motion Control functions are there in STEP 7 (TIA Portal) V11 and how do you use these
functions?
In STEP 7 V11, how do you configure data blocks with the "Only store in load memory"
attributefor an S7-1200?
How do you open blocks that are know-how protected in STEP 7 V11 in a different project when
they have been downloaded from the CPU?
How in STEP 7 V11 do you save the value of an "HSC" (high-speed counter) for the S7-1200 after STOP
mode or after a restart?
Ins t ruc t ions
With the "Control high-speed counters" [CTRL_HSC] operation you can call and parameterize the highspeed counters supported by the CPU in your program. These high-speed counters are used to count
the pulses generated by a rotary transducer, for example.
After changing from STOP to RUN mode or after switching the power supply off and on again, the highspeed counters "HSC" are reinitialized and the counters are reset to zero. The table below explains how
to proceed to retain or save the values of the high-speed counters after a CPU STOP.
No. P roc edure
1

To execute the "Control high-speed counters" [CTRL_HSC] operation, you must enable the highspeed counters "HSC" in the device configuration.

support.automation.siemens.com/BR/llisapi.dll?func=cslib.csinfo&lang=en&objid=41995947&caller=view

1/5

30/11/2013

Siemens Industry Online Support - Automation Service, Automation Support, Simatic Service, Simatic Support, Technical Support, Technical Consult

1. In the project navigation, open the device configuration in the mark the "PLC_1..." folder.
2. In the device configuration, open the "Properties" of the CPU and open the "High-speed
counters (HSC)" folder in the area navigation. The properties of the high-speed counters
are displayed in the right window.
3. To enable the high-speed counter "(HSC)1", you activate the "Enable this high-speed
counter for use" option.
4. For the high-speed counter (Name: "HSC_1") you define the functions as shown in the
example in Fig 01.

Fig. 01
2

Create a global data block with the symbolic name "DB HSC retain", for example, and define the
variable "HSC_1" of data type "DInt" in the DB. The counter value is saved in this DB variable.

Fig. 02
support.automation.siemens.com/BR/llisapi.dll?func=cslib.csinfo&lang=en&objid=41995947&caller=view

2/5

30/11/2013

Siemens Industry Online Support - Automation Service, Automation Support, Simatic Service, Simatic Support, Technical Support, Technical Consult

Not e
The current counter value is not provided for in the parameters for the "Control high-speed
counters" [CTRL_HSC] operation. The address for the process image is assigned to the highspeed counter in the hardware configuration and includes the current counter value. You can read
out the counter value directly via the program logic. The value output in your program is a correct
counter value for the moment in which the counter was read. The counter continues counting
high-speed results. The actual counter value can therefore change before your program has
completed a process with an old counter value.
3

Create a time interrupt OB (OB201) with a cycle time of 10 ms, for example, and insert the
"MOVE" instruction in Network 1.
1. Parameterize the input parameter of the "MOVE" instruction with the initial address of the
high-speed counter "HSC_1" and define a symbolic variable for this ("HSC1_CV", for
example). The initial address for the high-speed counter HSC_1 is ED1000 by default.
2. Parameterize the output parameter with the DB variable "DB HSC retain.HSC_1".
When the program is executed, the counter value of the high-speed counter "HSC_1" is
transferred to the DB variable every 10 ms.

Fig. 03
4

1. Create a start OB (OB100) and insert the "MOVE" instruction in Network 1.


2. Parameterize the input parameter of the "MOVE" instruction with the DB variable "DB
HSC retain.HSC_1" and the output parameter with the defined variable "NEW_CV1"
(MD24). The "NEW_CV1" variable is also assigned to the "NEW_CV" parameter of the
"Control high-speed counters" [CTRL_HSC] operation.
3. Now do a restart. The counter value in the DB variable is transferred as start value to the
"NEW_CV1" variable with which the high-speed counter begins to count again.
To enable the counter value, insert the "Set output" [S] instruction in another network and
parameterize the operands with the defined variable "CV1" (M10.1).

support.automation.siemens.com/BR/llisapi.dll?func=cslib.csinfo&lang=en&objid=41995947&caller=view

3/5

30/11/2013

Siemens Industry Online Support - Automation Service, Automation Support, Simatic Service, Simatic Support, Technical Support, Technical Consult

Fig. 04
6

Now, call the "Control high-speed counters" [CTRL_HSC] operation in a block (OB1, for example)
and parameterize the input and output parameters. Once the current counter value has been
enabled with the variable "CV1" (M10.1), the parameter "CV" is reset again. Insert the "Reset
output" [R] instruction in another network and parameterize the operands with the variable "CV1"
(M10.1).

support.automation.siemens.com/BR/llisapi.dll?func=cslib.csinfo&lang=en&objid=41995947&caller=view

4/5

30/11/2013

Siemens Industry Online Support - Automation Service, Automation Support, Simatic Service, Simatic Support, Technical Support, Technical Consult

Fig. 05
7

Compile your program by right-clicking on the "PLC_1..." folder in the project navigation and
executing the menu command "Compile > All" from the pop-up menu. Then save your project.

More information is available in the STEP 7 (TIA Portal) V11 Online Help under "CRTL_HSC: Control
high-speed counters (S7-1200)".
Creat ion env ironment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V11.
E nt ry ID: 41995947 Dat e: 2012-02-20
Siemens AG 2013 - Corporate Information - Privacy Policy - Terms of Use

support.automation.siemens.com/BR/llisapi.dll?func=cslib.csinfo&lang=en&objid=41995947&caller=view

5/5

Vous aimerez peut-être aussi