Events – Function of inputs status. Related TML Instructions and Data |
Setting any of these events allows you to detect when:
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:
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:
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:
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:
Variables
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
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
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 |