ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

RC SERVO CONTROL VIA TPU


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

RC SERVO CONTROL VIA TPU

Lessons from the Trenches by Jeff Loeliger

Start ý The Answer Isý ý Designing Functions ý Demonstration ý Youýre in Control ý Sources and PDF

THE ANSWER ISý

The solution proposed here is to use the Motorola time processor unit (TPU) to generate the necessary control signals for the servo. The TPU is an intelligent timing coprocessor module. It has its own program and data memory and can generate complex waveforms without CPU intervention. It is available on many of Motorolaýs 16- and 32-bit micro-controllers.

 

Using the TPU eliminates all the issues encountered by the current servo control options available. With this solution, generating the control signal causes no loading on the CPU therefore freeing it up to handle CPU-critical functions. The TPU allows a simple interface to the servo, making control easy and, as the output signal is always accurate, jitter is not a problem. No external hardware is required, eliminating the extra cost and space required with the custom chip and external board solutions currently available. Probably the most important feature of this solution is the TPUýs ability to control up to 16 servos simultaneously using its 16 I/O channels. The Motorola MPC555 has two TPU3 (for information on the differences between TPU, TPU2, and TPU3, see this sidebar) modules onboard and can therefore push this even further by controlling 32 servos at the same time.

SOLUTION DESCRIPTION

The servo function has four parameters that need to be configured by the host CPU (see Figure 2). The first parameter, POSITION, is an 8-bit value that represents the desired position of the output signal. This is the only parameter that needs to be changed while the function is actually running. A change performed by the user will vary the position of the servo. The remaining three parameters define and limit the output waveform and are in counts referenced by the selected timebase.

Figure 2ýEach TPU channel has its own parameter and this shows how they are laid out for the servo function.

 

There are two timebases on the TPU that can be selected by the user. The MIN_COUNT parameter defines the minimum length of the control signal with MAX_COUNT defining the maximum length. Both of these parameters must be less than $8000 and the MIN_COUNT must be set lower than the MAX_COUNT.

The range of movement of the servo can be limited by using MIN_COUNT and MAX_COUNT values that are less than the actual minimum and maximum values for the servo. By decreasing the range, the resolution is increased. The REPEAT parameter specifies the amount of time between the rising edges of the control signal. The user specifies the number of times $8000 timer counts should be repeated during the output delay. The time is then calculated as Delay = REPEAT ý $8000. There are two additional parameters, DELTA and REPEAT_COUNT, used by the function but not changed by the user.

There are two host-sequence bits, HSQ0 and HSQ1, that control the configuration of the servo function. HSQ0 is used to select one of the two timebases in the TPUý0 for timebase 1 (TCR1) and 1 for timebase 2 (TCR2). HSQ1 is used to choose between normal and reversed servo operation. Normally, a position value of 0 represents the minimum time for the output signal with $FF representing the maximum time. When HSQ1 is set, the operation is reversed with 0 representing the maximum time and $FF the minimum. This arrangement allows greater flexibility and is a quick-fix solution should the servo turn out to travel in the opposite direction to that planned. In addition, the servo function uses two host service requestsýHSR%11 and HSR%01. HSR%11 initializes the function and HSR%01 causes the immediate update of the servo position.

PREVIOUSNEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ