Example Program 4: MM_S4_Vis_SwitchRecipe

Program Introduction

Description

The PLC triggers Mech-Vision to switch the parameter recipe, triggers the Mech-Vision project to run, and then obtains the vision result.

File path

You can navigate to the installation directory of Mech-Vision and Mech-Viz and find the file by using the Communication Component/Robot_Interface/EthernetIP/Programming Samples/AB PLC EthernetIP/sample applications/ExportedRoutineOfSampleProjects/MM_S4_Vis_SwitchRecipe.L5X path.

Project

Mech-Vision project (The parameter recipe must 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_S4_Vis_SwitchRecipe example program.

The only difference between the MM_S4_Vis_SwitchRecipe example program and the MM_S1_Vis_Basic example program is that MM_S4_Vis_SwitchRecipe can switch the parameter recipe in the Mech-Vision project (Rung 5). As such, only the feature of switching the parameter recipe is described in the following section. For information about the parts of MM_S4_Vis_SwitchRecipe that are consistent with those of MM_S1_Vis_Basic, see Example Program 1: MM_S1_Vis_Basic.
sample4 1
sample4 2
sample4 3
sample4 4
sample4 5
sample4 6
sample4 7
sample4 8

The figure below describes the process of the above example program. The feature of switching the parameter recipe in the Mech-Vision project in the above program is shown in the section indicated by the red line in the figure below.

sample4 9

The table below describes the process of switching the parameter recipe in the Mech-Vision project.

  • For the Standard Interface functions of AB 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 AB PLC, please refer to Common Functions.

Feature Description

Switch the Mech-Visionparameter recipe and determine the subsequent operations based on whether the recipe is switched successfully

sample4 6
  • Camera_User.Switch_Recipe: The flag that triggers the parameter recipe in the Mech-Vision project to be switched when a rising edge occurs.

  • Camera_User.Status_Code_Error[10]: The flag that indicates the vision system status code is abnormal. True indicates that the parameter recipe in the Mech-Vision project failed to be switched, which means that the vision system is abnormal.

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

Rung 5 indicates that if Camera_User.Step_Num is set to 3, the following operations are performed.

  1. Enable MM_Switch_Recipe. In this case, the parameter recipe ID is 1 (Vision_Recipe_Num is set to 1) by default. You can modify the ID based on actual scenarios.

  2. When MM_Switch_Recipe.EnableOut is set to True and FromCamera.TRIGGER_ACKNOWLEDGE is set to False, set Camera_User.Switch_Recipe. In this case, the PLC triggers the Mech-Vision to switch the parameter recipe.

  3. If the value of FromCamera.STATUS_CODE is greater than or equal to 1001 and less than or equal to 1099, an exception occurs in the vision system. In this case, after receiving the rising edge for the logic output by using the ONS function, set Camera_User.Status_Code_Error[10] and reset Camera_User.Switch_Recipe. For information about the cause of a specific status code, see Standard Interface status codes and error codes.

  4. If the value of FromCamera.STATUS_CODE is 1107 and FromCamera.COMMAND_COMPLETE is set to True, the vision system has successfully executed the function sent by the PLC. In this case, the ONS function receives the rising edge for the logical output, assigns a value of 5 to Camera_User.Step_Num, and then resets Camera_User.Status_Code_Error[10] and Camera_User.Switch_Recipe.

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.