Multitasking Makes a Difference in Motion Control

Feb. 6, 1998
Machine builders often use one centrally located controller to run multiple tasks

Machine builders often use one centrally located controller to run multiple tasks. Although most controllers housing a single processor can provide multitasking routines, they only operate on one task at a time. Thus, multitasking does not mean data are handled simultaneously for numerous tasks. Data usually pass between a main task and others, or directly between tasks, where the main task coordinates or controls their activities.

A limiting factor is the controller’s single CPU. It normally requires one or more clock cycles to execute operating instructions on one piece of data. High-end CPUs and DSPs can run a little faster by executing memory fetches and read/write instructions in the same processor clock cycle. But they also work on only one piece of data at a time.

More than one CPU is needed to run simultaneous multitasking. However, when only one processor is available, it must handle multiple tasks in time slices. The CPU divides processing time between individual tasks, switching from one task to the next until all have received a piece of the processing time. Then it returns to the first task to repeat the procedure. Even controllers that execute multiple programs, such as those for handling I/O, user interfaces, and motion control, divide the programs into basic tasks, but do not process them simultaneously.

Many different schemes are used to define the amount of time allocated to each task and the conditions for switching between these tasks. In most cases, the choice depends upon the specific application. In typical real-time control systems, however, critical tasks such as servoloop updates occur more frequently than user interface tasks such as key strokes.

Conventional multitasking methods use multiple programs and conveniently divide machine control into logical programming tasks. But they have a downside. For example, programmers must decide the efficient scheduling of the time slices, because only a finite amount is available. They must then assign priorities to each program and decide how data should flow between programs when switching from one to another.

Such decisions add complexity to programming applications and uncertainty to how and when individual tasks are to be processed. In real-time applications, such uncertainty can result in less than optimum performance. Also, much engineering time is devoted to the details of the multitasker rather than solving the real application problem.

However, a new motion controller has been developed that employs an embedded multitasking operating systems and a single program. The system relieves users from allocating time, priorities, and switching criteria to individual programs. Instead, a multitasking real-time kernel periodically switches between key tasks within the single program. Real-world events generate interrupts providing rapid response to critical external events.

A timer interrupt starts the servoloop update and reads the encoder, I/O, and operator panel. Communications and position capture generate interrupts to the processor, but do not affect the servoloop update process. These controllers contain single user programs written in C or proprietary languages (such as in Mint from Baldor). During each multitasker pass, the next command in the program loads and executes. In an interrupt-driven event, subroutines within the main program define the commanded response to that event.

These motion controllers also support subroutines. They may be used to define a single process such as I/O or user input handling. They may be called numerous times from within the main program or from another subroutine. Hardware inputs can be used to generate interrupts which call a service subroutine. In this way, real-world events receive time-critical handling.

Information for this article was provided by Phil Strong, director of motion controls at Baldor Motors and Drives, 5711 R. S. Boreham Jr. St., Fort Smith, AR 72908.

© 2010 Penton Media, Inc.

Sponsored Recommendations

How to Build Better Robotics with Integrated Actuators

July 17, 2024
Reese Abouelnasr, a Mechatronics Engineer with Harmonic Drive, answers a few questions about the latest developments in actuators and the design or engineering challenges these...

Crisis averted: How our AI-powered services helped prevent a factory fire

July 10, 2024
Discover how Schneider Electric's services helped a food and beverage manufacturer avoid a factory fire with AI-powered analytics.

Pumps Push the Boundaries of Low Temperature Technology

June 14, 2024
As an integral part of cryotechnology, KNF pumps facilitate scientific advances in cryostats, allowing them to push temperature boundaries and approach absolute zero.

The entire spectrum of drive technology

June 5, 2024
Read exciting stories about all aspects of maxon drive technology in our magazine.

Voice your opinion!

To join the conversation, and become an exclusive member of Machine Design, create an account today!