Technical data

Appendix
27.6 Sample Programs
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 647
Declaring the Variables of the FC for the Valves
Just as with the FB for the motor, you must also declare the input, output, and in/out parameters for
the FC for the valves (see following variable declaration table).
Address Declaration Name Type Initial Value
0.0 IN Open BOOL FALSE
0.1 IN Close BOOL FALSE
2.0 OUT Dsp_Open BOOL FALSE
2.1 OUT Dsp_Closed BOOL FALSE
4.0 IN_OUT Valve BOOL FALSE
With FCs, the temporary variables are saved in the L stack. The input, output, and in/out variables
are saved as pointers to the logic block that called the FC. Additional memory space in the L stack
(after the temporary variables) is used for these variables.
Programming the FC for the Valves
The FC1 function for the valves must be created before OB1 since the called blocks must be
created before the calling blocks.
The code section of FC1 appears as shown below in the STL programming language:
Network 1 Open/close and latching
A(
O #Open
O #Valve
)
AN #Close
= #Valve
Network 2 Display "valve open"
A #Valve
= #Dsp_Open
Network 3 Display "valve closed"
AN #Valve
= #Dsp_Closed