Engineering Notes

Motion Programming Example: Loop Function For Repeated Motion

Written by Johann Tang | Nov 3, 2020 7:14:14 PM

No matter how many functions a product offers, without an intuitive, easy-to-use software, those functions can be difficult to implement.

Oriental Motor makes it easy for their customers by offering a universal MEXE02 support software that is compatible with products from multiple series.  Since each product offers different functions, the software format changes to match the product.  Having the same software user interface for different products can shorten the time required for programming motion sequences of each axis.

The loop function is available when any AZ series products is used with the MEXE02 software.

For an introduction of the software, please read this blog post or click on the image below.

The Loop Function

One of the most common motion sequences for stepper motors is a repeated motion in the exact distance and direction every time.  This is typically called a loop subroutine in programming terms, which meant that any set of instructions that is contained in the loop subroutine would be repeated either indefinitely, or until a condition is met.  Once that loop completes, then it returns to the main program.

The following excerpt is from the AZ series functions manual.

The loop function is a function to repeat the operation of the linked operation data number for the number of times set.

Operation is repeated from the operation data number for which "Loop count" is set to the operation data number to which "Loop end number" is set for the number of times set in the "Loop count." When the operation for the number of times set is completed, the operation transits to the operation data number that is set to "Next data number".

Basically, a loop function repeats the same move by the numbers of times you set.  This is useful for applications requiring the same fixed distance every time, such as paper/ticket feeding or rotary index tables.

Application Example:

For a ticker feeder, the motion is going to be the same every time, so let's use another example where multiple moves need to be repeated; like a robot doing a dancing routine with its arms and head whenever someone walks by.  In this application, you can use an AZ motor for the arm rotation joints, link 3 different moves together (No.0, No.1, No.2) sequentially, loop them for x amount of times, then once the loop completes, it will move onto the next data set (No.3), then the motion sequence ends.  Remember to hold that pose at the end.

This is what we want to do...

  • Perform No.0 motion
  • Perform No.1 motion
  • Perform No.2 motion
  • Loop No.0, No.1, No.2 motion 3 times
  • Perform No.3 motion

This is how we program it...

Take a look at the usage example below to see how this motion sequence is actually programmed on the MEXE02 software.  Notice that only 3 data sets (#0, #1, #2) are necessary for this motion sequence.  One benefit of the MEXE02 software is that once a move is programmed and stored, there's no need to program it again.  The secret is in the second image where it shows "Next data No.", "Loop count", and "Loop end No.".  This tells the software how to execute data sets #0, #1, and #2.

And then...you're done (remember to save).  Here's what the motion looks like when we plot a chart.

The Case for More Driver Intelligence

Traditional stepper motor drivers are not very intelligent besides proving power and logic.  Basically, they just convert whatever pulse command it's receiving into motion on the motor.  The intelligence is actually on the host controller, like a PLC, where ladder logic and pulse output can be used to perform complex motion. 

The advantage of using a driver from the AZ series is its advanced motion sequence programming, which allows the AZ series driver to operate without a PLC in certain cases.  Several types of drivers are offered for multiple purposes, such as pulse input, stored data, and multi-axis.  Up to 256 "moves" can be programmed and stored in the driver's non-volatile memory.  More "moves" can be achieved by using fieldbus communication, such as Modbus RTU, EtherNet/IP, or EtherCAT.

Advantages of Stored Data Programming

  • Saves space
  • Design is simplified
  • Lessen the burden of the host controller

By eliminating the PLC, more space is saved, and the design is simplified.  At the very least, the AZ series drivers should lessen the burden on the host controller, which means that a less expensive PLC or HMI can be used.  Since the AZ series motors have built-in mechanical absolute encoders, external encoders, batteries, and sensors are also eliminated.

Here's another application example with a linear slide.

 

Prefer to watch and learn?  Here's a video to show you how to do this.

 

For more information about the AZ series family of motors, actuators, and drivers, please click below.  The same dedicated drivers and the same MEXE02 software are used with all of these products.

Please subscribe!