Motion Library - Trigger

Name

Description

Return type

MLTrigClearFlag

Clears the flag of an initiated Trigger block

BOOL

MLTrigInit

Initializes a Trigger object

BOOL

MLTrigIsTrigged

Checks if the selected block has been triggered

BOOL

MLTrigReadDelay

Returns the time that the trigger block uses to compensate the delay of the sensorClosedA sensor is a type of transducer that converts one type of energy into another for various purposes including measurement or information transfer that captures the triggering signal

None

MLTrigReadPos

Returns the position of the block at the moment when it was triggered

None

MLTrigReadTime

Returns the time of the moment where the block was triggered in milliseconds

None

MLTrigSetEdge Sets the edge configuration for a Trigger object BOOL

MLTrigWriteDelay

Sets the time that the trigger block uses to compensate for the delay introduced by the sensor that captures the triggering signal

BOOL

FunctionMLTrigClearFlagPipe Network motion icon

Description

Clears the flag of an initiated Trigger block so the block can capture the position and time of the next event. Once triggered, a block has to be reset with this command before it can be triggered again. All events that are sent to a block while in a triggered state are ignored and the position and time information is lost.

Arguments

Input

BlockID

Description

ID number of an initiated Trigger object

 

Data type

DINT

 

Range

[-2147483648, 2147483648]

 

Unit

N/A

 

Default

Output

Default (.Q)

Description

Returns TRUE if function block is executed

See more details here.

 

Data type

BOOL

 

Unit

N/A

Return Type

BOOL

Related Functions

MLAxisRstFastIn

MLTrigIsTrigged

MLTrigReadPos

MLTrigReadTime

See Also

Example

Structured Text

 

//Clear Trigger Flag

MLTrigClearFlag( PipeNetwork.TRIGGER );

 

Ladder Diagram

MLTrigClearFlag: LD example

Function Block Diagram

MLTrigClearFlag: FBD example

Go back to the top of the page [Top]

FunctionMLTrigInitPipe Network motion icon

Description

Initializes a Trigger object for use in a PLCClosed"Programmable Logic Controller" A Programmable Logic Controller, PLC, or Programmable Controller is a digital computer used for automation of industrial processes, such as control of machinery on factory assembly lines. Used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events Program. FunctionClosedA function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. block is automatically called if a Trigger Block is added to the Pipe Network, with user-defined settings entered in the Pipe Blocks Properties screen.

The Trigger object monitors a selected Fast Input and captures the time of a rising or falling edge event. With the time and pipe position information the Trigger object extrapolates the axis position when the Fast Input event occurred.

Parameters to enter include the name of the Pipe Block, the Axis where the Fast Input is located, the number of the desired Fast Input, and whether to trigger on the rising or falling edge of the input.

See also "Fast inputs" for more details.


  • Trigger objects are normally created in the Pipe Network using the graphical engine. Then you do not have to add MLTrigInit function blocks to their programs. Parameters are entered directly in pop-up windows, and the code is then automatically added to the current project.

Arguments

Input

BlockID

Description

ID number of a created Pipe Block

 

Data type

DINT

 

Range

[-2147483648, 2147483648]

 

Unit

N/A

 

Default

     

Input_Axis

Description

Name of the axis where the Fast Input is located

 

Data type

STRING

 

Range

 

Unit

N/A

 

Default

     

InputID

Description

ID number of the Fast Input

0 = Touch Probe 1 / Capture Engine 0

1 = Touch Probe 2 / Capture Engine 1

Range is [0,1]

 

Data type

DINT

 

Range

[-2147483648, 2147483648]

 

Unit

N/A

 

Default

     

EdgeID

Description

Trigger at rising or falling edge of Fast Input. Enter 1 for rising edgeClosedA rising edge is the transition of a digital signal from low to high. It is also called positive edge, 2 for falling edge, and 0 disables the Fast Input

 

Data type

DINT

 

Range

[0 , 2]

 

Unit

N/A

 

Default

1 (Rising edge)

Output

Default (.Q)

Description

Returns TRUE if function block is executed

See more details here.

 

Data type

BOOL

 

Unit

N/A

Return Type

BOOL

Related Functions

MLTrigIsTrigged

MLTrigReadPos

MLTrigClearFlag

MLAxisRstFastIn

See Also

Example

Structured Text

//Create and Initiate a Trigger Pipe Block named “Trigger” and set it up to receive the trigger signal from Axis1, capture engine 0, and the rising edge of the signal
TRIGGER := MLBlkCreate( 'TRIGGER', 'TRIGGER' );
MLTrigInit( TRIGGER, 'Axis1', 0, 1 );

Ladder Diagram

MLTrigInit: LD example

 

Function Block Diagram

MLTrigInit: FBD example

Go back to the top of the page [Top]

FunctionMLTrigIsTriggedPipe Network motion icon

Description

Checks if the selected block has been triggered. When a block has been triggered, it contains the time and position when a Fast Input event occurred. The application has to reset the block before the block can be triggered again. All trigger events that are sent to the block during its triggered state are lost.

MLTrigIsTrigged

 

Figure 7-109: MLTrigIsTrigged


  • Once triggered, a block has to be reset before it can be triggered again. All events that are sent to a block while in a triggered state are ignored and the position and time information is lost.

Arguments

Input

BlockID

Description

ID number of an initiated Trigger object

 

Data type

DINT

 

Range

[-2147483648, 2147483648]

 

Unit

N/A

 

Default

Output

Default (.Q)

Description

Returns TRUE if the selected Trigger Object has Triggered

See more details here.

 

Data type

BOOL

 

Unit

N/A

Return Type

BOOL

Related Functions

MLTrigReadPos

MLTrigReadTime

See Also

Example

//Check if a Trigger Block has been triggered, then save position

IF MLTrigIsTrigged( PipeNetwork.TRIGGER ) THEN

Trig_Position := MLTrigReadPos( PipeNetwork.TRIGGER );

END_IF

 

Ladder Diagram

MLTrigIsTrigged: LD example

 

Function Block Diagram

MLTrigIsTrigged: FBD example

Go back to the top of the page [Top]

FunctionMLTrigReadDelayPipe Network motion icon

Description

Electronic sensors are not able to respond immediately to a signal. Sensors usually require a certain amount of time to process a change of state in their input signal. This function returns the delay that has been programmed in a trigger block by the MLTrigWriteDelay function to compensate for this reaction time required by the sensor.

Input

BlockID

Description

Identifier of the trigger block whose delay is requested

 

Data type

DINT

 

Range

[-2147483648, 2147483648]

 

Unit

N/A

 

Default

En

Description

Enables execution
 

Data type

BOOL
 

Unit

N/A
 

Default

-

Output

Delay

Description

Value of the delay compensation currently applied by the trigger block

 

Data type

LREAL

 

Unit

microseconds

OK

Description

Returns true when the function successfully executes
 

Data type

BOOL
 

Unit

N/A

Related Functions

MLTrigWriteDelay

See Also

Go back to the top of the page [Top]

FunctionMLTrigReadPosPipe Network motion icon

Description

Returns the position of the block at the moment when it was triggered by the Trigger Block's selected Fast Input. This value is only valid when TrigIsTrigged() returns TRUE. The Trigger block extrapolates the output value based on the timestampClosedA timestamp is a sequence of characters, denoting the date and/or time at which a certain event occurred of the Fast Input event to provide an accurate position even if the event occurs in the middle of a program cycle.

Once triggered, a block has to be reset before it can be triggered again. All events that are sent to a block while in a triggered state are ignored and the position and time information is lost.

See also "Fast inputs" for more details.

MLTrigReadPos

Figure 7-110: MLTrigReadPos

Arguments

Input

BlockID

Description

ID number of an initiated Trigger object

 

Data type

DINT

 

Range

[-2147483648, 2147483648]

 

Unit

N/A

 

Default

Output

Position

Description

Returns the position of the selected block's Axis at the moment when it was triggered

 

Data type

LREAL

 

Unit

User unit

Related Functions

MLTrigIsTrigged

MLTrigReadTime

MLTrigClearFlag

MLAxisRstFastIn

See Also

Previous Function Name

MLTrigGetPos

Example

Structured Text

 

//Save position of Axis when Fast Input event occurs

Trig_Position := MLTrigReadPos( PipeNetwork.TRIGGER );

 

Ladder Diagram

MLTrigReadPos: LD example

 

Function Block Diagram

MLTrigReadPos: FBD example

Go back to the top of the page [Top]

FunctionMLTrigReadTimePipe Network motion icon

Description

Returns the time of the moment where the block was triggered in milliseconds. This value is only valid when TrigIsTrigged() returns TRUE. The output is computed from the timestamp of a Fast Input time event

Once triggered, a block has to be reset before it can be triggered again. All events that are sent to a block while in a triggered state are ignored and the position and time information is lost.

See also "Fast inputs" for more details.

MLTrigReadTime

 

Figure 7-111: MLTrigReadTime

Arguments

Input

BlockID

Description

ID number of an initiated Trigger object

 

Data type

DINT

 

Range

[-2147483648, 2147483648]

 

Unit

N/A

 

Default

Output

Time

Description

Returns the time that the Trigger Block's selected Fast Input was triggered

 

Data type

LREAL

 

Unit

milliseconds

Related Functions

MLTrigIsTrigged

MLTrigReadPos

MLTrigClearFlag

MLAxisRstFastIn

See Also

Previous Function Name

MLTrigGetTime

Example

//Save time when Fast Input event occurs

Trig_Time := MLTrigReadTime( PipeNetwork.TRIGGER );

 

Ladder Diagram

MLTrigReadTime: LD example

 

Function Block Diagram

MLTrigReadTime: FBD example

Go back to the top of the page [Top]

FunctionMLTrigSetEdgePipe Network motion icon

Description

Sets the edge configuration (rising, falling, etc.) for a trigger block. This block should be called prior to calling MLAxisCfgFastIn. Also the value at the Edge input must match the value at MLAxisCfgFastIn’s Mode input.

Arguments

Input

BlockID Description Identifier of the trigger block

 

Data type DINT

 

Range [-2147483648, 2147483647]

 

Unit N/A

 

Default
Edge Description The edge on which to trigger
0 = disable the 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
1 = rising edge
2 = falling edge
  Data type DINT
  Range [0,2]
  Unit N/A
  Default 1 (rising edge)

Output

Q Description True if block executed successfully
False if execution is not successful

 

Data type BOOL

 

Unit N/A

Return Type

BOOL

See Also

Examples

Function Block Diagram

Ladder Diagram

Structured Text

FunctionMLTrigWriteDelayPipe Network motion icon

Description

Electronic sensors are not able to respond immediately to a signal. Sensors usually require a certain amount of time to process a change of state in their input signal. This function allows the trigger block to calculate the exact moment at which a signal was triggered by letting you specify the compensation. The delay compensation should include drive processing time, sensor delay, and the communication latency through the EtherCATClosedEtherCAT is an open, high-performance Ethernet-based fieldbus system. The development goal of EtherCAT was to apply Ethernet to automation applications which require short data update times (also called cycle times) with low communication jitter (for synchronization purposes) and low hardware costs network.

Input

BlockID Description Identifier of the trigger block

 

Data type DINT

 

Range [-2147483648, 2147483648]

 

Unit N/A

 

Default
Delay Description Reaction time of the sensor that the trigger block has to compensate

 

Data type LREAL

 

Range

 

Unit microseconds

 

Default

Output

Default (.Q)

Description Returns TRUE if the delay is successfully set

See more details here.

 

Data type BOOL

 

Unit N/A

Return Type

BOOL

Related Functions

MLTrigReadDelay

See Also

Go back to the top of the page [Top]

Usage example of Trigger Functions

When you call the MLTrigClearFlag function, the flag for trigger is reset to False.

When a Fast Input is set, the MLTrigIsTriggered function returns True.

Then you can call the MLTrigReadPos and MLTrigReadTime functions to get more details.

Trigger Functions Usage

Figure 7-112: Trigger Functions Usage

Go back to the top of the page [Top]