Example: Fast Homing with the PLCopen Motion Engine

This example shows how to use the axes' motion library functions to detect the positive edge of the first Fast Input in the drive, and read its position. MC_TouchProbe and the Trig_Ref library function are used to accurately perform a homing procedure.

  1. Set up an instance of the TrigRef function in the Dictionary.
    This example used the A1_TrigRef name.
  2. Define the TrigRef values.
    A1_TrigRef.InputID := 0;    // configure Drive Capture Engine Used
    A1_TrigRef.TrigID := 0;     // configure which Drive to capture an input
    A1_TrigRef.Direction := 1;  // configure Signal transition Direction of capture
    A1_TrigRef.TrigMode := 1;   // configure Time or Position Capture
  3. Activate the TouchProbe function.
    Inst_MC_TouchProbe( True, AxisID, A1_TrigRef, FALSE, 0, 0 );

  • The position capture can be time-based ( A1_TrigRef.TrigMode := 0 ) or position-based ( A1_TrigRef.TrigMode := 1 ).