Example Program 5: MM_S5_Viz_SetBranch

Program Introduction

Description

The PLC starts the Mech-Viz project, sets the exit port for the Branch by Msg Step, and then obtains the planned path from the Mech-Viz project.

File path

You can find the program file by using the Communication Component/Robot_Interface/Siemens Snap7/TIA Portal/sample applications/SampleProjectSnap7.zip path in the installation directory of Mech-Vision and Mech-Viz.

Project

Mech-Vision project and Mech-Viz project (The Branch by Msg Step needs to be configured beforehand.)

Prerequisites

This example program is provided for reference only. Before using the program, please modify the program according to the actual scenario.

Program Description

This part describes the MM_S5_Viz_SetBranch example program.

The only difference between the MM_S5_Viz_SetBranch example program and the MM_S2_Viz_Basic example program is that MM_S5_Viz_SetBranch can set the exit port of the Branch by Msg Step in the Mech-Viz project (Network 6). As such, only the feature of setting the exit port of the Branch by Msg Step is described in the following part. For information about the parts of MM_S5_Viz_SetBranch that are consistent with those of MM_S2_Viz_Basic, see Example Program: MM_S2_Viz_Basic.
sample5 1
sample5 2
sample5 3
sample5 4
sample5 5
sample5 6
sample5 7

The figure below describes the process of the above example program. The feature of setting the exit port of the Branch by Msg Step in the Mech-Viz project in the above program is shown in the section indicated by the red line in the figure below.

sample5 8

The table below describes the process of setting the exit port of the Branch by Msg Step in the Mech-Viz project.

  • For the Standard Interface functions of Siemens S7 Series PLC, you can click the hyperlink to the function name in the following explanation to view the detailed description of the function.

  • For common functions that come with Siemens S7 Series PLC, see Common Functions.

Feature Description

Set the exit port for the Branch by Msg Step in the Mech-Viz project and determine the subsequent operations based on whether the exit port is set successfully

sample5 6
  • "Camera_User".Set_Branch: The flag that triggers the exit port of the Branch by Msg Step to be set when a rising edge occurs.

  • "Camera_User".Status_Code_Error[10]: A vision system status code exception flag. True indicates that the exit port of the Branch by Msg Step in the Mech-Viz project failed to be set, which means that the vision system is abnormal.

For more information about input and output parameters in MM_Set_Branch, see MM_Set_Branch.

Network 6 indicates that if "Camera_User".Step_Num is set to 8, the following operations are performed.

  1. MM_Set_Branch is enabled. In this case, the Branch by Msg Step ID and exit port number are 1 by default. You can modify the Step ID and exit port number based on actual scenarios. In other words, the Mech-Viz project will proceed along exit port 0 of the 1 Branch by Msg Step, as shown in the following figure.

    set branch
  2. When "MM Interface".FromCamera."Trigger Acknowledge" is set to False and "Camera_User".Status_Code_Error[10] is set to False, "Camera_User".Set_Branch is set and the PLC triggers the Mech-Viz project to set the exit port of the Branch by Msg Step.

  3. If the value of "MM Interface"FromCamera."Status Code" is greater than or equal to 2001 and less than or equal to 2099, an exception occurred in the vision system. In this case, after the rising edge for the logic output is obtained by using the P_TRIG function, "Camera_User".Status_Code_Error[10] is set and "Camera_User".Set_Branch is reset. For information about the cause of a specific status code, see Standard Interface status codes and error codes.

  4. If the value of "MM Interface"FromCamera."Status Code" is 2105, the vision system has successfully executed the function sent by the PLC. In this case, the P_TRIG function is called to retrieve the rising edge for the logical output, a value of 10 is assigned to "Camera_User".Step_Num, and "Camera_User".Set_Branch and "Camera_User".Status_Code_Error[10] are reset.

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.