0% found this document useful (0 votes)
9 views7 pages

MC_CallSubprogram_LRob Function Overview

The document describes the function MC_CallSubprogram_LRob, which allows for the execution of subprograms on a robot controller (RC) by sending a JobID and supports both acyclic and cyclic data transmission between a PLC and the RC. It details various processing modes, error handling, and the parameters involved, including how to manage execution states and data exchanges. Additionally, it warns about potential unexpected robot behavior when modifying certain parameters during execution.

Uploaded by

littletree2025
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views7 pages

MC_CallSubprogram_LRob Function Overview

The document describes the function MC_CallSubprogram_LRob, which allows for the execution of subprograms on a robot controller (RC) by sending a JobID and supports both acyclic and cyclic data transmission between a PLC and the RC. It details various processing modes, error handling, and the parameters involved, including how to manage execution states and data exchanges. Additionally, it warns about potential unexpected robot behavior when modifying certain parameters during execution.

Uploaded by

littletree2025
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 MC_CallSubprogram_LRob

Group: Profile Core

1.1 Description
This function calls a subprogram located in the RC. It is called by transmitting the
corresponding JobID via the input parameter "JobID".
The function can transmit acyclic data bidirectional between PLC and RC. To exchange
cyclic data between PLC and RC for the execution of a subprogram the functions
"MC_WriteCallSubprogramCyclic_LRob" and "MC_ReadCallSubprogramCyclic_LRob"
must be used.
The array length of the acyclic parameter array "Data" scales with the data transmitted
with the command but is limited to a maximum length of 190 bytes.
When you are using this function, you must implement the conversion into the required
data types on both PLC and RC.

This function can execute subprograms on the RC once or continuously. It is also


possible to specify the buffer where it is processed. You specify this behavior with the
input parameter "ProcessingMode".
When "ProcessingMode" is set to "Continuous", the function repeats executing the
subprogram assigned via "JobID" once it has finished. To stop the execution of
"MC_CallSubprogram_LRob", "ProcessingMode" must be set to "Deactivate". The
subprogram execution is then stopped as soon as possible by the RC and the output
parameter "Done" returns TRUE. The function "MC_CallSubprogram_LRob", the called
subprogram and all functions executed within the called subprogram can also be stopped
by the execution of the function "MC_StopSubprogram_LRob"
When the subprogram assigned via "JobID" is being processed the output parameter
"InProgress" returns TRUE.
It is possible to modify the input parameter values of "Data" during execution of this
function in "ProcessingMode" "Continuous".
It is not possible to modify "ProcessingMode" while the function is being processed in
"Continuous" to any other "ProcessingMode" than "Deactivate In this case the output
parameter "Valid" is reset, and the RC returns an error. You can find more details in the
example in chapter [Link].
When this function is processed in the parallel buffer, the called subprogram cannot
execute move commands on the RC. If a move command is detected within the
subprogram the RC returns an error and a corresponding ErrorID. Simultaneously the
execution of the subprogram and the function "MC_CallSubprogram_LRob" are aborted.
When "MC_CallSubprogram_LRob" is executed in the sequence, move commands can
be executed by the called subprogram. In this case the functions "MC_GroupStop_LRob"
"MC_GroupInterrupt_LRob" and "MC_GroupContinue_LRob" also affect the execution of
"MC_CallSubprogram_LRob", and the functions executed within the called subprogram.

When the input parameter "SequenceFlag" is set to primary or secondary while the
specified "ProcessingMode" is not set to a sequence buffer, an error and a corresponding
ErrorID are output.
When the specified "ProcessingMode" is set to a sequence buffer when the
"SequenceFlag" is set to "No sequence", an error and a corresponding ErrorID are output
as well.

By default, when a subprogram called via "MC_CallSubprogram_LRob is being


processed in the primary sequence (output parameter "InProgress" or
"CommandInterrupted" return TRUE) it is not possible to change the active sequence to
secondary. Commands that implicitly change the active sequence to secondary cannot be
executed in this situation either:
• "MC_GroupJog_LRob"
• "MC_ReturnToPrimary_LRob"
However, you can disable this restriction via the parameter
"AllowSecSeqWhileSubprogram" in "UserData"

Unexpected robot behavior


Depending on the robot manufacturer specific server implementation, disabling
WARNING the restriction described above via the parameter
"AllowSecSeqWhileSubprogram" can lead to unexpected behavior of the robot.
Inspect the robot manufacturer specific documentation thoroughly for more
information on this functionality.

You can find more information on the "ProcessingMode" in chapter 4.7 of the manual
You can find more information on primary and secondary sequence in chapter 4.3.4 of
the manual.

Via the output parameter "Progress" you can transmit the current progress of your
subprogram from the RC to the PLC. However, if you do not configure your subprogram
accordingly the output parameter does not return any values.

If supported by the RC, the function "MC_CallSubprogram_LRob" can be executed


multiple times with the same JobID (multi-instancing). If multi-instancing is not supported
by the RC, the RC returns an error and a corresponding ErrorID.
If no program is available with the requested JobID, an error is returned by the RC. If the
RC cannot execute the command or if another error occurs during the execution of this
function, the RC also returns an error and a corresponding ErrorID.
If a subprogram on the RC called through the sequence buffer runs into an error during its
execution, the RC interrupts the execution of that subprogram according to chapter. It
also interrupts possible movements of the robot and return a corresponding error with
corresponding ErrorID.
[Link] Parameters

Figure 1-1: MC_CallSubprogram_LRob


MC_CallSubprogram_LRob

BOOL Execute Done BOOL


Processing
USINT Valid BOOL
Mode
UINT JobID Busy BOOL
Sequence Command
USINT BOOL
Flag Buffered
SINT ListenerID InProgress BOOL
Command
BOOL
Aborted
Command
BOOL
Interrupted
Parameter
BOOL
Accepted
Error BOOL

ErrorID WORD

WarningID WORD

InfoID WORD

InstanceID DINT

Progress REAL

OriginID DINT
Invocation
USINT
Counter
Data
ARRAY[*] of BYTE ARRAY[*] of BYTE
ReturnData
ARRAY[*] of BYTE ARRAY[*] of BYTE
AxesGroup
"LRob_typeAxesGroup" "LRob_typeAxesGroup"

Table 1-1: Parameters of "MC_CallSubprogram_LRob"


Parameter Decla- Data type Default Description Group
ration value
Execute IN BOOL FALSE TRUE Command starts at the rising edge Ext.
Processing IN USINT 2 Defines the mode in which the command is Ext.
Mode processed
0 Buffered Ext.
• Relates to ListenerID = 0
• Buffered in sequence buffer
and executed once
1 Aborting Ext.
• Relates to ListenerID = 0
• Buffered in sequence buffer,
aborts and deletes previous
commands in sequence buffer
and executed once
2 Parallel Ext.
• Relates to ListenerID = 0
• Buffered in parallel buffer and
executed once
3 Continuous Ext.
Parameter Decla- Data type Default Description Group
ration value
• Buffered in parallel buffer and
executed continuously until
deliberate deactivation by user
• Returns new values when
changed (not cyclically)
9 Deactivate Ext.
• Deactivates and deletes
function from RC
JobID IN UINT 0 Program number of the subprogram in the RC Ext.
Sequence IN USINT 1 Sequence in which the command is executed Ext.
Flag
0 No sequence Ext.
• Relates to ProcessingMode 2
(Parallel), 3 (Continuous) and 9
(Deactivate)
• Command is not processed by
any sequence
1 Primary sequence Ext.
• Relates to ProcessingMode 0
(Buffered)
• Command is processed by
primary sequence
2 Secondary sequence Ext.
• Relates to ProcessingMode 0
(Buffered)
• Command is processed by
secondary sequence
ListenerID1 IN SINT 0 ID of associated trigger function. Ext.
Always positive.
0 No Trigger Ext.
• No trigger-related behavior
>0 Trigger Ext.
• Starts execution when the
trigger function with the
identical EmitterID is triggered.
Done OUT BOOL FALSE TRUE Command completed successfully Ext.
Valid OUT BOOL FALSE TRUE The output ReturnData returns valid Ext.
values according to the user defined
subprogram
Busy OUT BOOL FALSE TRUE FB is being processed. Ext.
CommandBuffered OUT BOOL FALSE TRUE Command is transferred and Ext.
confirmed by the RC.
InProgress OUT BOOL FALSE TRUE Requested subprogram on the RC is Ext.
in progress. Movement of the axes
via this subprogram is possible.
CommandAborted OUT BOOL FALSE TRUE The command was aborted by Core
another command.
CommandInterrupted OUT BOOL FALSE TRUE Command is interrupted during Core
execution and can be continued.
ParameterAccepted OUT BOOL FALSE TRUE Receiving of input parameter values Ext.
has been acknowledged by RC.
Error OUT BOOL FALSE TRUE An error occurred during the Ext.
execution of the command. Refer to
the ErrorID. for information about the
cause.
ErrorID OUT WORD 16#0000 ErrorID for error identification Ext.
WarningID OUT WORD 16#0000 WarningID for warning identification Ext.
InfoID OUT WORD 16#0000 InfoID for info identification Ext.
InstanceID OUT DINT 0 Unique system-generated ID of the instance of Ext.
MC_CallSubprogram_LRob.
Can be used to specifically stop instance of a
subprogram via the function
Parameter Decla- Data type Default Description Group
ration value
MC_StopSubprogram_LRob if multi-instancing
is supported by RC
Progress OUT REAL -1.0 Percentage of already processed subprogram Ext.
(must be configured by user)
OriginID OUT DINT 0 Unique system-generated ID of the "Action" Ext.
when the function is triggered
Relates to ListenerID >0
>0 The "Action" is started by the trigger Ext.
function with identical FollowID
<0 The "Action" is stopped by the trigger Ext.
function with identical FollowID
InvocationCounter OUT USINT 0 Number of successful trigger-based command Ext.
invocations
Relates to ListenerID >0
Data2 IN_OUT ARRAY[*] - Acyclic input parameters of the subprogram Ext.
of BYTE written from PLC to RC
Array length adjusts to transmitted data (max
190 bytes).
ReturnData2 IN_OUT ARRAY[*] - Acyclic output parameters of the subprogram Ext.
of BYTE read from RC to PLC
Array length adjusts to transmitted data (max
190 bytes).
AxesGroup IN_OUT LRob_type - Robot assignment of function Ext.
AxesGroup

NOTE 1The parameter "ListenerID" is part of the "Profile: Extended". It is not supported
by version V1.0.0.1 of the "SIMATIC Robot Library".

NOTE 2These parameters cannot be left unwired. If you do not require the acyclic
exchange of data between PLC and RC for the execution of a subprogram you
can wire an empty array with a single element.

Unexpected robot behavior


Changing the parameter values of "AxesGroup" during the execution of the
WARNING command can lead to unexpected behavior of the robot.
Make sure that the user program does not change the assigned axes group is
not changed from the user program during the execution of the command.
[Link] Example

Figure 1-2: Example "MC_CallSubprogram_LRob"

1 3 5 8
2 4 6 7 9

1
Execute
0
t
9
3
Processing
2
Mode
1
0
t

Data
0

1
Busy
0
t
1
Done
0
t
1
Error
0
t
Parameter 1
Accepted 0

Command 1
Buffered 0

1
InProgress
0
t

ReturnData
0
t

(1) "ProcessingMode" "Buffered" is active.


"Execute" is set and reset while no other command is buffered in the active
sequence.
The function is processed, indicated by "Busy" switching to TRUE.
(2) The function returns values and is no longer being executed which is indicated
by "Done" switching to TRUE and "Busy" returning FALSE.
(3) "ProcessingMode" "Parallel" is active.
"Execute" is set and reset.
The function is processed, indicated by "Busy" switching to TRUE.
(4) The function returns values and is no longer being executed which is indicated
by "Done" switching to TRUE and "Busy" returning FALSE.
(5) "ProcessingMode" "Continuous" is active.
"Execute" is set and reset.
The function is processed, indicated by "Busy" switching to TRUE.
The function is continuously executed indicated by "InProgress" returning TRUE.
(6) While the function is active "Data" is changed.
"ParameterAccepted" switches to FALSE until the data change has been
accepted by the RC, which is indicated by "ParameterAccepted" switching back
to TRUE, and new values are returned by the RC.
(7) The continuous execution is stopped by "ProcessingMode" being changed to
"Deactivate".
The function is no longer being executed which is indicated by "Done" switching
to TRUE and "InProgress" and "Busy" returning FALSE.
(8) "ProcessingMode" "Continuous" is active.
"Execute" is set and reset.
The function is processed, indicated by "Busy" switching to TRUE.
The function continuously returns values indicated by "InProgress" continuously
returning TRUE.
(9) While the function is active "ProcessingMode" is changed.
"Error" switches to TRUE and "InProgress" returns FALSE. The function can no
longer return valid values until it is executed again.

You might also like