Jump to content
OMRON Forums

Motion program overwrites L variables?


Recommended Posts

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





send 0 "L0 before home %d", L0


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







-0: L0 before home 0

-0: L0 after home: 1

-0: L3 before jog: 0

-0: L3 after jog: 1024



Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

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.

Link to comment
Share on other sites

  • 9 months later...

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?

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...