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.
{
const int TOUCH_PROBE_OUTPUT_INDEX = 3;
const int TOUCH_PROBE_STATUS_INDEX = 6;
const int TOUCH_PROBE_VALUE_INDEX = 7;
const ulong TOUCH_PROBE_ON_EACH_Z_PHASE_COMMAND = 0x17;
ulong currentStatus = controller.NetworkInputValueGet(TOUCH_PROBE_STATUS_INDEX);
Console.WriteLine($"Touch Probe Status: 0x{currentStatus:X}");
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.
{
const int TOUCH_PROBE_OUTPUT_INDEX = 3;
const int TOUCH_PROBE_STATUS_INDEX = 6;
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;
const ulong TOUCH_PROBE_2_ON_FIRST_FALLING_EXT2_COMMAND = 0x2100;
controller.NetworkOutputValueSet(TOUCH_PROBE_OUTPUT_INDEX, TOUCH_PROBE_2_ON_FIRST_FALLING_EXT2_COMMAND);
ulong currentStatus = controller.NetworkInputValueGet(TOUCH_PROBE_STATUS_INDEX);
Console.WriteLine($"Touch Probe 2 Status: 0x{currentStatus:X}");
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