Jump to content
OMRON Forums

Reusable Motion Program


mshaver

Recommended Posts

I've read that Motion Programs are not owned by any one coordinate system and that multiple coordinate systems can access the same program simultaneously. (Sounds analogous to a class module in object oriented languages)

 

I have to execute the exact same logic for four different motors in 4 different coordinate systems. I'd like to use a single motion program and just "tell" the program which axis of which system is to execute but I don't see how this is possible. In a motion program, don't I have to use an explicit axis name for a motion command? IE; X(expression). So right now, I have 4 separate motion programs that are identical except for the axis letter in the motion commands. IE; one program has a series of move commands that look like X(expression), another program is identical except for the use of Y(expression), and another is identical except for the use of Z(expression), and so on. If I make changes, I have to change 4 programs.

 

How do I get around this and have a single motion program that can operate on either X, Y, Z, etc., based on a parameter passed to the program when executed?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Just like Stephen stated. Make the following assignments (using your own axis definitions):

&1 #1->1000X

&2 #2->1000X

&3 #3->1000X

&4 #4->1000X

 

And say you have motion program 1 with X moves, now you would issue the following online command: &1B1R &2B1R &3B1R &4B1R.

This command can be automated; sent from a PLC executing whichever coordinate system you would like based on the setting of one or more flags. In any order or combinations.

Link to comment
Share on other sites

If you don't feel like calling them all X, you could use a switch statement inside your program that calls the axis you want. It's not very elegant, but should work.

 

For example, define something like

 

global AxisToUse(3);

/*

AxisToUse=0, use X-Axis

AxisToUse=1, use Y-Axis

AxisToUse=2, use Z-Axis

*/

 

#define _X 0

#define _Y 1

#define _Z 2

 

// Then, in your motion program:

 

switch(AxisToUse)

{

case _X:

X(MoveDistance);

break;

 

case _Y:

Y(MoveDistance);

break;

 

case _Z:

Z(MoveDistance);

break;

 

default:

X(MoveDistance);

break;

 

}

 

 

Then you just need to set the AxisToUse value before running your program.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...