!CAP                Set event when the selected capture input goes low or high

Syntax                        

!CAP

! if CAPture triggered

 

Operands

PlaceTMLOnline

Binary code

DescriptionSets the event condition when the programmed transition occurs on one of the 2 capture inputs. Typically, on the capture inputs are connected the 1st and 2nd encoder index. 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

After you have programmed an event, you can do the following actions:

Change the motion mode and/or the parameters when the event occurs, with command UPD!
Stop the motion when the event occurs, with command STOP!
Wait for the programmed event to occur, with command WAIT!

The programmed event is automatically erased when the event occurs or if the timeout for the WAIT! command expires.

Remark: After setting UPD! or STOP! you need to wait until the programmed event occurs using WAIT!, otherwise, the program will continue with the next instructions that may override the event monitoring.

 

ExecutionActivates the monitoring of the event, when the programmed transition (low to high or high to low) occurs on the selected capture input. This operation erases a previous programmed event that has occurred.

Example                

//Stop motion on next encoder index

ENCAPI1; //Enable 1st capture input for low->high transitions

!CAP; // Set event on 1st capture (low->high transition)

STOP!;//Stop the motion when event occurs

WAIT!;//Wait until the event occurs

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