Ex. 3: CIP Sync - Touch Probes - Simple Example

In this example, one touch probe and a rising edge will be used to capture the position, timestamp, and if desired, the count. This example will assume the touch probe has to be rearmed after a capture to generate a new capture (versus a continuous trigger). Axis 1 will be assumed and the default AXIS#.EIP.TP.SOURCE1 is DIN1.

Touch probe 1 Touch probe 2
Keyword Description Keyword Description

AXIS#.EIP.TP.CONTROL1

Touch probe 1 control byte

AXIS#.EIP.TP.CONTROL2

Touch probe 2 control byte

AXIS#.EIP.TP.STATUS1

Touch probe 1 status byte

AXIS#.EIP.TP.STATUS2

Touch probe 2 status byte

AXIS#.EIP.TP.POSLATCH1

Touch probe 1 position positive value

AXIS#.EIP.TP.POSLATCH2

Touch probe 2 position positive value

AXIS#.EIP.TP.NEGLATCH1

Touch probe 1 position negative value

AXIS#.EIP.TP.NEGLATCH2

Touch probe 2 position negative value

AXIS#.EIP.TP.SOURCE1

Touch probe 1 source

AXIS#.EIP.TP.SOURCE2

Touch probe 2 source

AXIS#.EIP.TP.POSTIME1

Touch probe 1 timestamp positive value

AXIS#.EIP.TP.POSTIME2

Touch probe 2 timestamp positive value

AXIS#.EIP.TP.NEGTIME1

Touch probe 1 negative value

AXIS#.EIP.TP.NEGTIME2

Touch probe 2 timestamp negative value

AXIS#.EIP.TP.POSCOUNT1

Touch probe 1 positive edge counter

AXIS#.EIP.TP.POSCOUNT2

Touch probe 2 positive edge counter

AXIS#.EIP.TP.NEGCOUNT1

Touch probe 1 negative edge counter

AXIS#.EIP.TP.NEGCOUNT2

Touch probe 2 negative edge counter

To control the arming and disarming of Touch probe 1, AXIS1.EIP.TP.CONTROL1 is mapped to the Command Mapping region of the CIP Sync Assembly using the WorkBench GUI.

Keywords mapped to the Command Mapping tab
Keyword Description

AXIS1.EIP.TP.CONTROL1

Modifies and configures the associated axis’ first touch probe control byte.

The following is mapped to the Response Mapping tab of the CIP Sync Assembly.

Keywords mapped to the Response Mapping tab
Keyword Description

AXIS1.EIP.TP.STATUS1

Monitors the status of Touch probe 1 on Axis 1

AXIS1.EIP.TP.POSLATCH1

Monitors and displays the last captured positive latched position on Touch probe 1, Axis 1

AXIS1.EIP.TP.POSTIME1

Monitors and displays the last captured timestamp on Touch probe 1, Axis 1

AXIS1.EIP.TP.POSCOUNT1

Monitors and displays the total running count of the capture even on Touch probe 1, Axis 1

Reference the DynamicMap array elements chart in the drop-down below to determine the DynamicMap array elements associated with the parameters.

For this example the following is true:

CIP Sync Command Assembly
Mapped Parameter Data Type WorkBench Addresses DynamicMap Array in PLC Tag Data Type

AXIS1.EIP.TP.CONTROL1

1 Byte

32

Name.Output.Data[0]

SINT

CIP Sync Response Assembly
Mapped Parameter Data Type WorkBench Addresses DynamicMap Array in PLC Tag Data Type

AXIS1.EIP.TP.STATUS1

1 Byte

24

Name.Input.Data[0]

SINT

AXIS1.EIP.TP.POSLATCH1

4 Byte Signed

25-28

Name.Input.Data[1] to Name.Input.Data[4]

DINT

AXIS1.EIP.TP.POSTIME1

8 Byte

29-36

Name.Input.Data[5] to Name.Input.Data[12]

LINT

AXIS1.EIP.TP.POSCOUNT1

2 Byte

37-38

Name.Input.Data[13] to Name.Input.Data[14]

INT

The following sample code was written in the PLC for the example application.

The first rung provides a N.O. contact Enable_Ax1_Touchprobe_1 to enable or disable Touch probe 1 for Axis 1.

  • Bit 0 = Enable/Disable when ON/OFF.

  • Bit 1 = Trigger First Event (non-continuous) when OFF.

  • Bits 2 and 3 when OFF, OFF sets the trigger with touch probe 1 input (DIN1).

The next two rungs use Bit 4 to arm or disarm the sampling of the positive edge of touch probe 1 for Axis 1.

The rung with the COP instruction sends the PLC data to the dynamically mapped control Byte.

In the following rungs for Touch probe status the dynamically mapped status Byte data is copied into a tag in the PLC.

  • Bit 0 of the tag indicates when the touch probe is enabled or disabled.

  • Bit 1 of the tag indicates when a positive value of touch probe 1 of Axis 1 is stored.

The stored bit behavior is such when the touch probe is armed and DIN1 input triggers the event on positive edge, status bit 1 turns ON indicating a new position capture occurred. When the control Byte disarms the sampling, bit 1 of the status Byte turns OFF. On re-arm and a new rising edge and capture, bit 1 turns ON again.

The next three rungs with COP instructions copy the dynamically mapped data into tags for monitoring in the ladder:

  1. The positive latched position

  2. The positive latched timestamp

  3. The positive edge counter that is incremented on the rising edge of the touch probe 1 input. The count will always be 0 or 1 when using "trigger first event".

    • 0: When disarmed

    • 1: When the capture event occurs in trigger first event mode

Demonstration

  1. First, enable the touch probe.

    The control byte changes to a value of 1 (0x01).

  2. Next, arm the touch probe.

    The control byte changes to a value of 17 (0x11).

    In the Response Mapping tab, the status (AXIS1.EIP.TP.STATUS1) has a value of 1 (0x01). AXIS1.EIP.TP.POSLATCH1 and AXIS1.EIP.TP.POSCOUNT1 both have a value of 0.

    The Touch probe status indicates the touch probe is enabled.

On the rising edge of DIN1 (Digital Input 1) the positive value stored coil, Ax1_Touchprobe1_Pos_Value_Stored, turns ON indicating a new touch probe capture occurred.

In Studio 5000's Quick Watch window the AXIS1_EIP_TP_POSLATCH1 value is 95640 and the AXIS1_EIP_TP_POSCOUNT1 is 1. The AXIS1_EIP_TP_POSTIME1 is the sync time taken at the time of the Touch probe capture.

Compare this to the Watch window in WorkBench where the position feedback is 95.641 deg and positive latched position is 95.640. This example assumes the EIP scaling for Axis 1 is setup for Ratio Input = 360000 and Ratio Output = 1 for degrees. See Scaling section for examples.


  1. To take another position capture, first disarm the touch probe.

  2. Next, rearm the touch probe.

    On rising edge of DIN1 the position capture takes place and a new value is stored. The Quick Watch window in Studio 5000 displays AXIS1_EIP_TP_POSLATCH1 with a value of 51016, AXIS1_EIP_TP_POSTIME1 with a value of 5451818687, and AXIS1_EIP_TP_POSCOUNT1 with a value of 1.

    WorkBench's Watch window displays AXIS1.PL.FB with a value of 51.1022 deg, AXIS1_EIP_TP_POSLATCH1 with a value of 51.106, and AXIS1_EIP_TP_POSCOUNT1 with a value of 1.