Advertisement

Quick Links

LM628 Programming Guide
Introduction
The LM628/LM629 are dedicated motion control processors.
Both devices control DC and brushless DC servo motors, as
well as, other servomechanisms that provide a quadrature
incremental feedback signal. Block diagrams of typical
LM628/LM629-based motor control systems are shown in
Figures 1, 2.
As indicated in the figures, the LM628/LM629 are bus pe-
ripherals; both devices must be programmed by a host pro-
cessor. This application note is intended to present a con-
crete starting point for programmers of these precision
motion controllers. It focuses on the development of short
programs that test overall system functionality and lay the
groundwork for more complex programs. It also presents a
method for tuning the loop-compensation PID filter. (Note 1)
Note 1: For the remainder of this paper, all statements about the LM628 also
apply to the LM629 unless otherwise noted.
© 2002 National Semiconductor Corporation
National Semiconductor
Application Note 693
Steven Hunt
January 1999
Reference System
Figure 15 is a detailed schematic of a closed-loop motor
control system. All programs presented in this paper were
developed using this system. For application of the pro-
grams in other LM628-based systems, changes in basic
programming structure are not required, but modification of
filter coefficients and trajectory parameters may be required.
I. Program Modules
Breaking programs for the LM628 into sets of functional
blocks simplifies the programming process; each block ex-
ecutes a specific task. This section contains examples of the
principal building blocks (modules) of programs for the
LM628.
FIGURE 1. LM628-Based Motor Control System
FIGURE 2. LM629-Based Motor Control System
AN010860
01086001
01086002
www.national.com

Advertisement

Table of Contents
loading

Summary of Contents for National Semiconductor LM628

  • Page 1 FIGURE 1. LM628-Based Motor Control System 01086002 FIGURE 2. LM629-Based Motor Control System Note 1: For the remainder of this paper, all statements about the LM628 also apply to the LM629 unless otherwise noted. © 2002 National Semiconductor Corporation AN010860...
  • Page 2: Busy-Bit Check Module

    See Figure 5. While the busy-bit all other filter coefficients and filter coefficient input buff- is set, the LM628 will ignore any commands or attempts to ers are set to zero. With d set to one, the derivative transfer data.
  • Page 3 LM628 command port-commands are written to the command port and the Status Byte is read from the command port. A logic level of “0” at PS selects the command port. Port d represents the LM628 data port — data is both written to and read from the data port. A logic level of “1” at PS selects the data port.
  • Page 4 This error signal is filtered by the PID filter to provide the motor drive signal. Note: Regardless of the free wheeling state of the shaft, the LM628 continu- ously tracks shaft absolute position. After executing the example initialization module, the follow- ing observations are made.
  • Page 5: Filter Programming Module

    LFIL command sequence. Immediately following the filter control word, the filter coeffi- cients are written. Each coefficient is written as a pair of data 01086009 FIGURE 7. LM628 — Simplified Block Diagram Form www.national.com...
  • Page 6 I. Program Modules (Continued) 01086010 FIGURE 8. Filter Control Word Bit Allocation TABLE 3. Derivative — Term Sampling Interval Selection Codes Filter Control Word Bit Position Selected Derivative-Term Sampling Interval — T • • • • • • • • •...
  • Page 7: Trajectory Programming Module

    Comments In the case of the example module, the first byte of the trajectory control word, 00 hex, programs the LM628 to After executing both the example initialization and example operate in position mode. The second byte, 0A hex, indi-...
  • Page 8: Stop Module

    This module demonstrates the programming flow required to stop shaft motion. Start Motion Control While the LM628 operates in position mode, normal stopping The start motion control command, STT, must be executed is always smooth and occurs automatically at the end of a to stop shaft motion.
  • Page 9: Loop Phasing Program

    Busy-bit Check Module II. Programs Load Trajectory Parameters An LTRJ (Load TRaJectory) command sequence includes This section focuses on the development of four brief LM628 command LTRJ, a trajectory control word, and a variable programs. number of data words. In the case of the Loop Phasing Program, the first byte of the...
  • Page 10 Figure 11 details the signals gener- ated by a 3-channel quadrature incremental encoder. The LM628 decodes (or “counts”) a quadrature incremental sig- nal to determine the absolute position of the shaft. The reference system uses a one thousand line encoder.
  • Page 11 II. Programs (Continued) 01086029 FIGURE 12. Calculations of Trajectory Parameters for Simple Absolute Position Move www.national.com...
  • Page 12: Simple Relative Position Move

    II. Programs (Continued) TABLE 8. Simple Absolute Position Move Program Port Bytes Command Comments Initialization Module Filter Programming Module LTRJ This command initiates loading the trajectory parameters input buffers Busy-bit Check Module These two bytes are the trajectory control word. A 2A hex LB indicates acceleration, velocity, and position will be loaded and all three parameters are absolute.
  • Page 13 II. Programs Using the number of counts traveled during acceleration and (Continued) the number of samples during acceleration, acceleration is determined. The reference system uses an 8 MHz clock. The sample Total counts traveled while at maximum velocity is four-fifths period of the reference system is determined.
  • Page 14: Basic Velocity Mode Move With Breakpoints

    II. Programs (Continued) Both acceleration and velocity values are scaled. Acceleration and velocity are rounded to the nearest integer and all three trajectory parameters are converted to hexa- decimal. 01086015 FIGURE 13. Velocity Profile for Simple Relative Position Move Program The number of samples while at maximum velocity is deter- mined.
  • Page 15 160,000 counts. When this absolute position is reached, the In the case of the examlple program, the second byte of the LM628 interrupts the host processor, and the host executes MSKI data word, 40 hex, enables the breakpoint interrupt. All a Smooth Stop Module.
  • Page 16 2.0 rev/s. The resultant velocity will be 4.0 rev/s. Busy-bit Check Module velocity data word (low) wait This wait represents the host processor waiting for an LM628 breakpoint interrupt. Start motion control. Busy-bit Check Module RSTI Reset interrupts.
  • Page 17 www.national.com...
  • Page 18 INTRODUCTION III. Tuning the PID Filter LM628 digital controller. loop-compensation filter of a PID controller is usually tuned BACKGROUND experimentally, especially if the system dynamics are not The transient response of a control system reveals important well known or defined.
  • Page 19 III. Tuning the PID Filter (Continued) Proportional Term The system sample period sets the time interval between updates of position error. The derivative sampling interval is an integer multiple of the system sample period. See Table 3. It sets the time interval between successive position error samples used in the derivative term, and, therefore, directly affects system damping.
  • Page 20 III. Tuning the PID Filter (Continued) TABLE 11. Initialization Section — Filter Tuning Program (Continued) Port Bytes Command Comments A 04 hex LB enables (unmasks) the trajectory complete interrupt. All other interrupts are disabled (masked). See Figure 6. Busy-bit Check Module LFIL This command initiates loading the filter coefficients input buffers.
  • Page 21 III. Tuning the PID Filter (Continued) Software Considerations The step generation section of the filter tuning program provides the control loop with a repetitive small-signal step input. This is accomplished by repeatedly executing a small position move with high maximum velocity and high accel- eration.
  • Page 22 Busy-bit Check Module RDSTAT This command reads the Status Byte. It is directly supported by LM628 hardware and can be executed at any time by pulling CS, PS, and RD logic low. Status information remains valid as long as RD is logic low.
  • Page 23 III. Tuning the PID Filter Figure 21 represents the step response of an under damped (Continued) control system; this response exhibits excessive overshoot Observations and long settling time. The filter parameters used to gener- ate this response were as follows: k , 35;...
  • Page 24: Life Support Policy

    NATIONAL’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT AND GENERAL COUNSEL OF NATIONAL SEMICONDUCTOR CORPORATION. As used herein: 1. Life support devices or systems are devices or 2.

This manual is also suitable for:

Lm629

Table of Contents