Fast Homing Example 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 InputClosedThe inputs are taken into account at each cycle depending on the system periodicity (for example each millisecond). Under certain circumstances this can be insufficient when more accuracy is needed, or if a quick response is required from the system. To fill the gap, a drive may have some Fast Input connections (generally one or two). When an event happens that triggers a Fast Input (e.g. when a sensor sends a rising edge), the detection of a signal occurs faster (which can be 1000 times more accurate than the system periodicity). Then the timestamp associated with this input can be provided to the IPC to take corrective action 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. For this example, the name A1_TrigRef is used.
  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 ).