Position incorrect after SAP 1, 0, 0 - PANdrive PD-140-42-SE

Position incorrect after SAP 1, 0, 0 - PANdrive PD-140-42-SE

Postby j.streibhardt » 14 Nov 2011, 11:22

Hello,
I'm running an "embedded" TMCL program on a PANdrive PD-140-42-SE. After power on the program is supposed to slowly turn to the end of the system (no switch possible, I'm using StallGuard). Afterwards it's supposed to turn back 63900 steps after which I'm stetting this point as 0 position.
Oddly enough the corresponding GAP command for the current position will return different values for the axis position, often somewhere in between (-10000 to -30000). Especially if the system is powered on "in between" and not at the lower end. Sometimes it's working correctly.
Am I missing something? (Shortened code below, system init removed)
Code: Select all
SAP 140, 0, 5 // 32 Steps
SAP 204, 0, 10 // freewheel time, 0 to disable
SAP 203, 0, 2048    //Disable Mixed Decay
SAP 5, 0, 700    //Set Acceleration
SAP 4, 0, 1000    //Set maximum Velocity
SAP 205, 0, 5 //Turn on Stall Detection
// move to end
SAP 205, 0, 0 // turn off stall detection
SAP 203, 0, -1 // mixed decay
MVP REL, 0, -63900
WAIT POS, 0, 0

SAP 1, 0, 0

I've also tried some delay (instead of and after WAIT POS) but it doesn't seem to have any effect. If I issue a MVP ABS 0, 0 after the SAP it's crashing violently into the lower barrier of the system.
j.streibhardt
User
User
 
Posts: 4
Joined: 14 Nov 2011, 11:05

Re: Position incorrect after SAP 1, 0, 0 - PANdrive PD-140-4

Postby Olav Kahlbaum (TRINAMIC) » 15 Nov 2011, 08:42

Please insert a MST 0 command before your SAP 1, 0, 0 command to switch the drive to velocity mode (and not positioning mode) before changing the actual position. Otherwise the position regulator of the motion controller IC will always try to equalize actual position and target position when one of these parameters gets changed (which will make the motor move and result in the effects you are seeing).
When zeroing the actual position it is also good practise to zero also the target position (SAP 0, 0, 0). So it is best to make the last three lines of your program like this:
Code: Select all
MST 0
SAP 1, 0, 0
SAP 0, 0, 0
User avatar
Olav Kahlbaum (TRINAMIC)
Site Admin
 
Posts: 3365
Joined: 11 Aug 2006, 08:02

Re: Position incorrect after SAP 1, 0, 0 - PANdrive PD-140-4

Postby j.streibhardt » 15 Nov 2011, 10:25

Thanks for your advice, I will try this as well. Oddly enough it's apparently working consistently when I change the last three commands to
Code: Select all
SAP 1, 0, 63900
MVP ABS, 0, 0
WAIT POS, 0, 0
j.streibhardt
User
User
 
Posts: 4
Joined: 14 Nov 2011, 11:05

Re: Position incorrect after SAP 1, 0, 0 - PANdrive PD-140-4

Postby Olav Kahlbaum (TRINAMIC) » 16 Nov 2011, 08:39

These lines will set the actual position to 63900 and then make the motor move to position 0. Because of the fast program exection speed this may work as well but maybe you won't always get at the exact position then. Better use the recommended way.
User avatar
Olav Kahlbaum (TRINAMIC)
Site Admin
 
Posts: 3365
Joined: 11 Aug 2006, 08:02


Return to Modules / Command set related issues

Who is online

Users browsing this forum: No registered users and 2 guests