Skip to content

Warning

This package is DEPRECATED, please use the Modbus TCP/IP Interface package instead.

Siemens S7-1200: Execute drag&bot programs with arguments

Use the Siemens S7-1200 PLC to execute drag&bot programs with arguments.

In drag&bot Studio

  1. Create your program.
  2. Deploy the program on the robot system in the program overview. See here how to deploy a program.

In TIA project

The following TIA function blocks are provided by the drag&bot TIA library with the described parameters. They can be used to communicate with the drag&bot Line Controller component and execute drag&bot programs.

To start the execution of a drag&bot program with input parameters a command has to be assembled. Commands contain a start function, one or more functions to add arguments and a send function.

The d&b_exe_with_args_start_command function is called to start the command creation. Then the d&b_exe_with_args_add_argument function can be called to add arguments to the command. This is possible until the the holding register is filled. Following attempts to add arguments are ignored and the Success output returns false. The arguments have to be added in the same order as they are listed in the drag&bot program. The arguments can be of type Bool, Int, Word, Pose, Real and String each as single variables or array, except Bool which cannot be added as an array. Arguments added as array are added as single values one after another. After all arguments have been added, the d&b_exe_with_args_send_command function is called, which sends the constructed command to the drag&bot system.

To stop, pause and resume drag&bot programs please refer to the chapter here.

The functions to assemble a command are described in the following:

d&b_exe_with_args_start_command

The d&b_exe_with_args_start_command function starts assembling a command to execute a drag&bot program with input parameters.

Group Parameter Type Description
Input Program_Name String The name of the drag&bot program to be executed. It is case sensitive.
Output Success Bool Is true, if the command was written to the Holding Register.
InOut MB_Holding_Register Array[*] of Word The linked Holding Register of the Modbus server. The * indicates a variable size.

The d&b_exe_with_args_start_command function requires the Program_Name input to be set that the assembling of a execute command is started. In the same cycle the Success output indicates a successful or unsuccessful writing to the respective Modbus register. The Modbus register stays locked for writing until the d&b_exe_with_args_send_command clears the lock. During this time it is not possible to receive information from the Line Controller component.

d&b_exe_with_args_add_argument

The d&b_exe_with_args_add_argument function adds an argument to the command, which overwrites the respective input parameters of a drag&bot program.
The arguments can be of type string, boolean, integer, float or pose. These types can also be added as an array, where the elements of the array are added one after the other. The maximum size of an Array is 10, larger arrays are ignored. Arrays of type boolean are not supported.

Group Parameter Type Description
Input Argument Variant The argument to be added to the command.
Output Success Bool Is true, if the command was written to the Holding Register.
InOut MB_Holding_Register Variant The linked Holding Register of the Modbus server.

The d&b_exe_with_args_add_argument function requires the Argument input to be set, which is the input parameter to be added to the command. In the same cycle the Success output indicates a successful or unsuccessful writing to the respective Modbus register. The Modbus register stays locked for writing until the d&b_exe_with_args_send_command clears the lock. During this time it is not possible to receive information from the Line Controller component.

d&b_exe_with_args_send_command

The d&b_exe_with_args_send_command function sends an assembled command, which starts the drag&bot program.

Group Parameter Type Description
Input Start Bool If true, the command is sent to the Line Controller.
Output Success Bool Is true, if the command was sent to the Line Controller.
Result Byte The result of the program execution:
0 = No result received
1 = Success
2 = Canceled
3 = Error
Program_Started Bool Is true, if the program has been started successfully.
InOut MB_Holding_Register Array[*] of Word The linked Holding Register of the Modbus server. The * indicates a variable size.

The d&b_exe_with_args_send_command function requires the Start input to be set so that the request is sent to the Line Controller component. In the same cycle the Success output indicates a successful or unsuccessful writing to the respective Modbus register. When the program was started the output Program_Started will be true for one cycle. After the program has been stopped the output Result indicates the program result for one cycle.

Example Program

An example for assembling and sending a command with two arguments is shown below. The command creation is encapsulated in a seperate function. The d&b_exe_with_args_send_command function requires to be called each cycle to receive the results from drag&bot and is therefore outside of the function.