P3: Basic PLC Program for SINUMERIK 840D sl
13.13 Block descriptions
Basic Functions
Function Manual, 09/2011, 6FC5397-0BP40-2BA0
1015
13.13.17 FC 9: ASUB startup of asynchronous subprograms
Function
The FC ASUB can be used to trigger any functions in the NC. Before an ASUB can be started from the PLC, it
must have been selected and parameterized by an NC program or by FB 4 (PI service ASUB). The channel and
the interrupt numbers for the parameters in FC 9 must match here.
Once prepared in this way, it can be started at any time from the PLC. The NC program running on the channel in
question is interrupted by the asynchronous subprogram. Only one ASUB can be started in the same channel at
a time. If the start parameter is set to logical 1 for two FC 9s within one PLC cycle, the ASUBs are started in the
sequence in which they are called.
The start parameter must be set to logic 0 by the user once the ASUB has been terminated (Done) or if an error
has occurred.
For the purpose of job processing, every FC ASUB requires its own WORD parameter "Ref" from the global user
memory area. This parameter is for internal use only and must not be changed by the user. The parameter "Ref"
is initialized with the value 0 in the first OB 1 cycle and, for this reason, every FC 9 must be called absolutely.
Alternatively, the user can initialize parameter "Ref" with a value of 0 during startup. This option makes
conditional calls possible. When a conditional call is activated by parameter "Start" = 1, it must remain active until
parameter "Done" has made the transition from 1 to 0.
Declaration of the function
Note
The FB 4 call must be terminated before the FC 9 can be started. FC 9 cannot be started if
"Emergency off" is set. Neither can FC 9 be started if the channel reset is active.
FUNCTION FC 9 : VOID
//NAME :ASUP
VAR_INPUT
Start:
BOOL ;
ChanNo:
INT;
IntNo:
INT;
END_VAR
VAR_OUTPUT
Active:
BOOL ;
Done :
BOOL ;
Error :
BOOL ;
StartErr:
BOOL ;
END_VAR
VAR_IN_OUT
Ref:
WORD ;
END_VAR