APIs, concepts, guides, and more
Axis: Touch Probe

Learn how to use Touch Probe with Panasonic Drives in C#.

Warning
This is a sample program to assist in the integration of the RMP motion controller with your application. It may not contain all of the logic and safety features that your application requires. We recommend that you wire an external hardware emergency stop (e-stop) button for safety when using our code sample apps. Doing so will help ensure the safety of you and those around you and will prevent potential injury or damage.

The sample apps assume that the system (network, axes, I/O) are configured prior to running the code featured in the sample app. See the Configuration page for more information.


In this page:


📜 Touch Probe: Capture Index Pulse

Learn how to capture position on each Z-phase (index pulse) during motion using the PDO method. This example configures Touch Probe 1 for continuous capture, triggering on the Z-phase positive edge. Useful for Capture/Probe 📖 applications requiring periodic position capture during motion.

// PDO Method - captures position on each Z-phase (index pulse) during motion
void CaptureEachIndexPulseDuringMotion(MotionController controller)
{
// these constants likely will not be those you use - adjust based on your network configuration
const int TOUCH_PROBE_OUTPUT_INDEX = 3; // networkoutput #3 - touch probe function
const int TOUCH_PROBE_STATUS_INDEX = 6; // networkinput #6 - touch probe status
const int TOUCH_PROBE_VALUE_INDEX = 7; // networkinput #7 - touch probe pos1 pos value
// enable touch probe:
// bit 0 = 1 (enable touch probe 1)
// bit 1 = 1 (continuous capture - overwrites old values)
// bit 2 = 1 (trigger on z-phase)
// bit 4 = 1 (sample positive edge)
// binary: xxxx xxxx xx01 x111 = 0x17
const ulong TOUCH_PROBE_ON_EACH_Z_PHASE_COMMAND = 0x17;
// enable touch probe
controller.NetworkOutputValueSet(TOUCH_PROBE_OUTPUT_INDEX, TOUCH_PROBE_ON_EACH_Z_PHASE_COMMAND);
// evaluate status
ulong currentStatus = controller.NetworkInputValueGet(TOUCH_PROBE_STATUS_INDEX);
Console.WriteLine($"Touch Probe Status: 0x{currentStatus:X}");
// initiate motion so you get a new position every z-phase
// (your motion code here)
// after currentStatus bit 1 goes high, you have your first (of many) z-phase
ulong lastZPhasePosition = controller.NetworkInputValueGet(TOUCH_PROBE_VALUE_INDEX);
Console.WriteLine($"Last Z-Phase Position: {lastZPhasePosition}");
}

Source: touch-probe.cs


📜 Touch Probe: Capture Position on Signal

Learn how to capture position on the falling edge of an external input (SI6/EXT2) using the SDO method. This example configures Touch Probe 2 for first-event capture on the falling edge of external input. Ideal for Capture/Probe 📖 applications with discrete trigger events.

// SDO Method - captures position on falling edge of external input SI6 (EXT2)
void CapturePositionOnFallingEdgeOfSI6(MotionController controller, Axis axis)
{
// assuming touch probe status is still available as pdo entries
const int TOUCH_PROBE_OUTPUT_INDEX = 3; // networkoutput #3 - touch probe function
const int TOUCH_PROBE_STATUS_INDEX = 6; // networkinput #6 - touch probe status
// sdo addresses for touch probe 2 falling edge value
const int TOUCH_PROBE_2_FALLING_EDGE_VALUE_INDEX = 0x60BD;
const int TOUCH_PROBE_2_FALLING_EDGE_VALUE_SUB_INDEX = 0x0;
const int TOUCH_PROBE_2_FALLING_EDGE_VALUE_SIZE = 0x4;
// enable touch probe 2:
// bit 8 = 1 (enable touch probe 2)
// bit 9 = 0 (first event only)
// bit 10 = 0 (trigger on ext2)
// bit 13 = 1 (sample negative/falling edge)
// binary: xx1x x001 xxxx xxxx = 0x2100
const ulong TOUCH_PROBE_2_ON_FIRST_FALLING_EXT2_COMMAND = 0x2100;
// enable touch probe 2
controller.NetworkOutputValueSet(TOUCH_PROBE_OUTPUT_INDEX, TOUCH_PROBE_2_ON_FIRST_FALLING_EXT2_COMMAND);
// evaluate status
ulong currentStatus = controller.NetworkInputValueGet(TOUCH_PROBE_STATUS_INDEX);
Console.WriteLine($"Touch Probe 2 Status: 0x{currentStatus:X}");
// after currentStatus bit 10 goes high, the following value is useful
int fallingEdgeExt2 = axis.NetworkNode.ServiceChannelRead(
TOUCH_PROBE_2_FALLING_EDGE_VALUE_INDEX,
TOUCH_PROBE_2_FALLING_EDGE_VALUE_SUB_INDEX,
TOUCH_PROBE_2_FALLING_EDGE_VALUE_SIZE);
Console.WriteLine($"Falling Edge EXT2 Position: {fallingEdgeExt2}");
}

Source: touch-probe.cs