100BBasic instructions
7.3 Counters
S7-1200 Programmable controller
182
System Manual, 11/2011, A5E02486680-05
This option depends upon whether the FB was created as symbolic access only. Once the
FB has been created, you cannot change the checkbox for "Symbolic access only"; it must
be chosen correctly when the FB is created, on the first screen after selecting "Add new
block" from the tree. To see how this box is configured for an existing FB, right-click on the
FB in the Project tree, choose properties, and then choose attributes.
If the FB was created with the "Symbolic access only" box checked:
1.
Open the FB for edit.
2.
Place the counter instruction at the desired location in the FB.
3.
When the Call options dialog appears, click on the Multi instance icon. The Multi Instance
option is only available if the instruction is being placed into an FB.
4.
In the Call options dialog, rename the counter if desired.
5.
Click OK. The counter instruction appears in the editor with type INT for the preset and
count values, and the IEC_COUNTER structure appears in the FB Interface under Static.
6.
If desired, change the type in the counter instruction from INT to one of the other types.
The counter structure will change correspondingly.
Type shown in counter instruction (for preset
and count values)
Corresponding structure Type shown in FB
interface
INT
IEC_Counter
SINT
IEC_SCounter
DINT
IEC_DCounter
UINT
IEC_UCounter
USINT
IEC_USCounter
UDINT
IEC_UDCounter
1.
If necessary, open the FB interface editor (may have to click on the small arrow to
expand the view).
2.
Under Static, locate the counter structure that was just created for you.
3.
In the Retain column for this counter structure, change the selection to "Retain".
Whenever this FB is called later from another program block, an instance DB will be
created with this interface definition which contains the counter structure marked as
retentive.
If the FB was created with the "Symbolic access only" box
not checked:
1.
Open the FB for edit.
2.
Place the counter instruction at the desired location in the FB.
3.
When the Call options dialog appears, click on the multi instance icon. The multi instance
option is only available if the instruction is being placed into an FB.
4.
In the Call options dialog, rename the counter if desired.
5.
Click OK. The counter instruction appears in the editor with type INT for the preset and
count value, and the IEC_COUNTER structure appears in the FB Interface under Static.
6.
If desired, change the type in the counter instruction from INT to one of the other types.
The counter structure will change correspondingly.