You are here: Start » Program Examples » HMI Start Stop - simple version

HMI Start Stop - simple version

Aim

The task is to create a simple application where user activates an inspection mode through the HMI Panel.

If inspection mode is not activated, input image is displayed.

In the inspection mode threshold operation is performed.

Hints

Use a Variant macrofilter to have multiple alternative execution paths, in this case you need to have two variants. The forking port type input is connected to the Checked output of the HMI Inspect check box control.

Solution (AVS)

  1. Add the GrabImage_FromFiles filter to load a single image from a file. Place it in the ACQUIRE section

  2. Create the Variant macrofilter Inspection and create the inImage input of type Image. In Creating a Variant macrofilter window:

    • Define the forking port of type Bool.
    • Set its Name to State.
  3. In the True variant: add the ThresholdImage filter and connect its Image input with the macrofilter's input. Connect the ThresholdImage.outMonoImage output to the macrofilter's output.

  4. In the False variant: connect the macrofilter's Image input with the macrofilter's Image output.

  5. Open the HMI Designer. It is available in a View tab, or in a Toolbar.

  6. To allow the user to set the lower limit of threshold range, add to the HMI the TrackBar control available in the Controls category of HMI Controls.

  7. Add to the HMI the CheckBox control and set its Text parameter to Inspect.

    • Connect the outValue with the Variant State input. From now, program executes True variant if the Incpect checkbox is checked.
  8. Add to the HMI the VideoBox control and connect its input to the Variant outImage output.

  9. Generally the program is finished, however there is good practice to disable the controls which should not be used in each state.

  10. In the Variant macrofilter create the outControlsEnabled output of type Bool. In the True variant set the outControlsEnabled to True and in the False variant set the outControlsEnabled to False.

  11. Add the Delay filter and set the inTime to 50. This filter suspends the program workflow for 50 milliseconds.

Macrofilter Main.

Macrofilter Inspection(True)

Macrofilter Inspection(False)

Further Readings