Events – Function of inputs status. Related TML Instructions and Data

Setting any of these events allows you to detect when:

A transition occurs on one of the 2 capture inputs. On these inputs, are usually connected the 1st and 2nd encoder index signals
A transition occurs on one of the 2 limit switch inputs
A general purpose digital input changes its status

Capture and limit switch inputs events

The capture inputs and the limit switch inputs can be programmed to sense either a low to high or high to low transition. When the programmed transition occurs on either of these inputs, the following happens:

Motor position APOS_MT is captured and memorized in the TML variable CAPPOS, except the case of open-loop systems, where reference position TPOS is captured instead
Master position APOS2 or load position APOS_LD is captured and memorized in the TML variable CAPPOS2, except the case of steppers controlled open loop with an encoder on the load, when load position is captured in CAPPOS.

The selection between master and load position is done as follows: load position is saved in CAPPOS2 only for the setup configurations which use different sensors for load and motor and foresee a transmission ratio between them. For all the other setup configurations, the master position is saved in CAPPOS2. The master position is automatically computed when pulse and direction signals or quadrature encoder signals are connected to their dedicated inputs. More details about the capture process are presented at Special I/O – TML Programming Details

Remarks:

If both capture inputs are activated in the same time, the capture event is set by the capture input that is triggered first. The capture event makes no difference between the two capture inputs.
If the drive/motor accepts CANopen protocol, the home input is the same with the 2nd encoder index. Therefore, the home input can be programmed like a capture input to sense transitions and to memorize the load and master position when the transition occurs.

In order to set an event on a capture input, you need to:

1) Enable the capture input for the detection of a low->high or a high-> low transition, using one of the TML instructions: ENCAPI0, ENCAPI1, EN2CAPI0, EN2CAPI1

2) Set a capture event, with the TML instruction: !CAP

3) Wait for the event to occur, with the TML instruction: WAIT!

Remarks:

When the programmed transition is detected, the capture input is automatically disabled. In order to use it again, you need to enable it again for the desired transition
You may also disable a capture input (i.e. its capability to detect a programmed transition) previously enabled, using the TML commands: DISCAPI, DIS2CAPI

In order to set an event on a limit switch input, you need to:

1) Enable the limit switch input for the detection of a low->high or a high-> low transition, using one of the TML instructions: ENLSP0, ENLSP1, ENLSN0, ENLSNI1

2) Set a limit switch event with one of the TML instructions: !LSP, !LSN

3) Wait for the event to occur, with the TML instruction: WAIT!

Remarks:

When the programmed transition is detected, the limit switch input is automatically disabled (for sensing transitions). In order to use it again, you need to enable it again for the desired transition
You may also disable a limit switch input (i.e. its capability to detect a programmed transition) previously enabled, using the TML commands: DISLSP, DISLSN

Variables

CAPPOSPosition captured when programmed transition occurs on 1st capture/encoder index input. Measured in motor position units, except the case of stepper motors, when it is measured in position units
CAPPOS2Position captured when programmed transition occurs on 2nd capture/encoder index input. Measured in position units when load position is captured, or in master position units when master position is captured
APOS2Master position computed by the slaves from pulse & direction or quadrature encoder inputs. Measured in master position units
TPOSTarget position – position reference computed by the reference generator at each slow loop sampling period. Measured in position units

APOS_LD        Actual load position. Measured in position units. Alternate name: APOS

APOS_MT        Actual motor position. Measured in motor position units.

Instructions:

!CAP                Set event on capture inputs

ENCAPI0        Enable 1st capture/encoder index input to detect a high to low transition

EN2CAPI0        Enable 2nd capture/encoder index input to detect a high to low transition

ENCAPI1        Enable 1st capture/encoder index input to detect a low to high transition

EN2CAPI1        Enable 2nd capture/encoder index input to detect a low to high transition

!LSN                Set event on negative limit switch input

!LSP                Set event on positive limit switch input

ENLSP0        Enable positive limit switch input to detect a high to low transition

ENLSN0        Enable negative limit switch input to detect a high to low transition

ENLSP1        Enable positive limit switch input to detect a low to high transition

ENLSN1        Enable negative limit switch input to detect a low to high transition

DISCAPI        Disable 1st capture/encoder index input to detect transitions

DIS2CAPI        Disable 2nd capture/encoder index input to detect transitions

DISLSP        Disable positive limit switch input to detect transitions

DISLSN        Disable negative limit switch input to detect transitions

UPD!        Update the motion mode and/or the motion parameters when the programmed event occurs
STOP!        Stop motion with the acceleration/deceleration set in CACC, when the programmed event occurs
WAIT! value16Wait until the programmed event occurs. If the command is followed by value16, the wait ends after the time interval specified in this 16-bit integer value. Value16 is measured in time units

Programming Example

//Stop motion on next encoder index

ENCAPI1; //Set event: When the encoder index goes low->high

!CAP;

STOP!;//Stop the motion when event occurs

WAIT!;//Wait until the event occurs

// now load/motor is in deceleration        

CPOS = CAPPOS; // new command position = captured position

CPA; //position command is absolute

MODE PP;

TUM1; //set Target Update Mode 1

UPD; //execute immediate

!MC; WAIT!; //wait for completion

 

General purpose digital inputs events

You can program an event on any general-purpose digital input. The event can be set when the input is high (after a low to high transition) or low (after a high to low transition).

A general purpose input event is checked at each slow loop sampling period, when the status of the selected input is compared with the one set in the event. A match triggers the event.

Instructions

!IN#n 1                Set event when the Input #n is high

!IN#n 0                Set event when input #n is low

UPD!        Update the motion mode and/or the motion parameters when the programmed event occurs
STOP!        Stop motion with the acceleration/deceleration set in CACC, when the programmed event occurs
WAIT! value16Wait until the programmed event occurs. If the command is followed by value16, the wait ends after the time interval specified in this 16-bit integer value. Value16 is measured in time units

Programming Example

// Start motion when digital input #36 is high

!IN#36 1; // set event when input #36 is high

//Position profile. Position feedback: 500-lines encoder

CACC = 0.3183;//acceleration rate = 1000[rad/s^2]

CSPD = 100;//slew speed = 3000[rpm]

CPOS = 20000;//position command = 10[rot]

CPA; //position command is absolute

MODE PP;

TUM1; //set Target Update Mode 1

UPD!; //execute on event

WAIT!;//Wait until the event occurs

 

See also:

Events – When the actual motion is completed. Related TML Instructions and Data

Events – Function of motor or load position Related TML Instructions and Data

Events – Function of motor or load speed Related TML Instructions and Data

Events – After a wait time Related TML Instructions and Data

Events – Function of reference Related TML Instructions and Data

Events – Function of 32-bit variable value Related TML Instructions and Data

Events – TML Programming Details

Special I/O – TML Programming Details