andyf Posted December 20, 2011 Posted December 20, 2011 Can someone please explain why L0 and L3 get overwritten when the following motion program is executed. There is nothing else running on my system nor any other active ssh connections: open prog 1 L0=0 L3=3 send 0 "L0 before home %d", L0 home3 send 0 "L0 after home: %d", L0 dwell 1000 send 0 "L3 before jog: %d", L3 jog 3 : 1024 send 0 "L3 after jog: %d", L3 close Output: -0: L0 before home 0 -0: L0 after home: 1 -0: L3 before jog: 0 -0: L3 after jog: 1024
curtwilson Posted December 20, 2011 Posted December 20, 2011 We have not been able to duplicate this so far. Still looking...
curtwilson Posted December 21, 2011 Posted December 21, 2011 I think I've figured it out. If you are using the kinematic-subroutine definitions for the axes in the coordinate system, the subroutines use their Ln for Motor n position when it has to perform a transformation. The forward-kinematic transformation after a jog or homing motor move to make sure the axis positions are right for the next programmed axis move. The subroutine's Ln is not necessarily the same as the motion program's Ln, and will only be the same if the motion program's "stack offset" is 0. The IDE's project manager automatically sets the stack offset to the number of local variables declared in the motion program -- you have none. If you declared at the top of the program: local Lvar0, Lvar1, Lvar2, and Lvar3; then the stack offset would be 4 and L0 for the kinematics routine would be equivalent to L4 of the motion program; L3 for the kinematics routine would be equivalent to L7 of the motion program.
andyf Posted October 10, 2012 Author Posted October 10, 2012 Update: I noticed with the latest version of the firmware that using "local Lvar0" when declaring a program directly through gpascii causes error #31: invalid data. I don't have this problem if I compile/download the program through the IDE...so there must be a difference. Our high level software on the host loads some programs to buffers using ssh/gpascii. What is the correct way to declare local variables in this case...to ensure there are not conflicts on the local variable stack?
Recommended Posts