SAP                Set actual position

Syntax                        

SAP value32

Set Actual Position to value32

SAP VAR32

Set Actual Position to VAR32

Operandsvalue32: 32-bit long immediate value

VAR32: long variable

PlaceTMLOnline

Binary code

DescriptionSets/changes the referential for position measurement by changing simultaneously the load position APOS and the target position TPOS values, while keeping the same position error POSERR. You can specify the new position either as an immediate value or via a 32-bit long variable. SAP command can be executed at any moment during motion and has the following effect:
If last motion mode setting was done with TUM1:

TPOS = new_value;

APOS = TPOS – POSERR;

If last motion mode setting was done without TUM1, i.e. with TUM0:

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:

AddressRange

 

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