Technical data
Appendix
27.6 Sample Programs
Programming with STEP 7
644 Manual, 05/2010, A5E02789666-01
Declaring the Variables of the FB for the Motor
You must declare the input, output, and in/out parameters of the FB for the motor.
Address Declaration Name Type Initial Value
0.0 IN Start BOOL FALSE
0.1 IN Stop BOOL FALSE
0.2 IN Response BOOL FALSE
0.3 IN Reset_Maint BOOL FALSE
2.0 IN Timer_No TIMER
4.0 IN Response_Time S5TIME S5T#0MS
6.0 OUT Fault BOOL FALSE
6.1 OUT Start_Dsp BOOL FALSE
6.2 OUT Stop_Dsp BOOL FALSE
6.3 OUT Maint BOOL FALSE
8.0 IN_OUT Motor BOOL FALSE
10.0 STAT Time_bin WORD W#16#0
12.0 STAT Time_BCD WORD W#16#0
14.0 STAT Starts INT 0
16.0 STAT Start_Edge BOOL FALSE
With FBs, the input, output, in/out, and static variables are saved in the instance DB specified in the
call statement. The temporary variables are stored in the L stack.
Programming the FB for the Motor
In STEP 7, every block that is called by a different block must be created before the block
containing its call. In the sample program, you must therefore create the FB for the motor
before OB1.
The code section of FB1 appears as follows in the STL programming language:
Network 1 Start/stop and latching
A(
O #Start
O #Motor
)
AN #Stop
= #Motor
Network 2 Startup monitoring
A #Motor
L #Response_Time
SD #Timer_No
AN #Motor
R #Timer_No
L #Timer_No