SAP Set actual position |
Syntax
VAR32: long variable Binary code
TPOS = new_value; APOS = TPOS – POSERR;
APOS = new_value; TPOS = APOS + POSERR; Remark: In case of steppers controlled open loop with no position feedback, SAP command sets the new position value only in TPOS. This instruction uses a 9-bit short address for the destination variable. Bit 9 value X specifies the destination address range:
Example // Position profile. Position feedback: 500 lines incremental // encoder (2000 counts/rev) CACC = 0.3183;//acceleration rate = 1000[rad/s^2] CSPD = 33.3333;//slew speed = 1000[rpm] CPOS = 6000;//position command = 3[rot] CPR; //position command is relative MODE PP; TUM1; //set Target Update Mode 1 UPD; //execute immediate !MC; // set event when motion is completed WAIT!;//Wait until the event occurs i.e. the motor stops // At this point TPOS=6000, APOS = 6000-POSERR SAP 2000; // Set actual position 1[rot] // Now, TPOS=2000, APOS=2000-POSERR |