Home
5328 User`s Manual
Contents
1. Sampling of actual shaft positioin occurs at a fixed frequen the reciprocal of which is the system sample period The system sample period is the unit of time upon which shaft acceleration and velocity are based Ts 2048 System Sample Period 4 The reference system uses 8 MHz clock The sample period of the reference system follows directly from the defi nition SECONDS Ts 2048 SAMPLE oon 256 x 10 5 106 2 7 Trajectory Parameters Calculations The shaft will accelerate at 0 1 rev sec until it reaches a maximum velocity of 0 2 rev sec and then decelerate to a stop exactly two revolutions from the starting position Trajectory parameters calculations for this move are de tailed in Figure 12 Comments After completing the move the contral system will atternpt to hold the shaft at its current absolute position The shaft will feel lightly spring loaded If forced away from its de sired resting position and released the shaft will move back to the desired position P 0000 1F 40 hex COUNTS ue 05 secos 29 sace 262 x 10 5 es X 65 536 re Eons Acceleration Scaled Em Acceleration Rounded A 00 00 00 02 hex 22018 v ex x 25 x 10 6 SECONDS 2 0 2048 COUNTS REVOLUTION SAMPLE SECOND SAMPLE 0 2048 on 65 536 13 421 77 V
2. Port Bytes Command Note 4 hardware Strobe RST pin 27 logic reset low for eight clock periods minimum Comments wait The maximum time to complete hardware reset tasks is 1 5 ms During this reset execution time the M628 will ignore any commands or attempts to transfer data RDSTAT This command reads the status byte 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 decision If the status byte is C4 hex or 84 hex continue Otherwise loop back to hardware reset Busy bit Check Module c 1 2 10 RSTI This command resets only the interrupts indicated by zeros in bits one through six of the next data word It also resets bit fifteen of the Signals Register and the host interrupt output pin pin 17 Busy bit Check Module d don t care Note 3 d 00 LB Zeros in bits one through six indicate interrupts will be reset Busy bit Check Module RDSTAT This command reads the status byte decision Ifthe status byte is CO hex or 80 hex continue Otherwise back to hardware reset PORT12 The reset default size of the DAC port is eight bits This command initializes the DAC port for a 12 bit DAC It should not be issued in systems with an B bit DAC Busy bit Check Module FIGURE 3 Initialization Module wi
3. Bit Poaltion Function Host Interrupt Bit 14 Acceleration Loaded But Not Updated Bit 13 UDF Executed But Filter Not yet Updated Bit 12 Forward Direction Bit 11 Velocity Moda Bit 10 On Target 8it 9 Tum Off upon Excessive Position Error Bit 8 Eight Bit Output Mode Bit 7 Motor Off 6 Breakpoint Reached Interrupt Bit 5 Excessive Position Error Interrupt Bit 4 Wraparound Occurred interrupt Bit 3 Index Pulse Acquired Interrupt Bit 2 Trajectory Complete Interrupt Bit 1 Command Error interrupt Bit 0 Acquire Next Index SIP Executed Bit 15 the host interrupt flag is set to logic one when the host interrupt output Pin 17 is logic one Pin 17 is set to logic one when any of the six host interrupt conditions occur if the corresponding interrupt has not been masked Bit 15 and Pin 17 are cleared command ASTI Bit 14 the acceleration loaded flag is 801 to logic one when acceleration data Is written to the 1 628 Bit 14 is Geared by the STT command Data Reporting Commands continued Bit 13 the UDF executed flag is set to logic one when the UDF command is executed Because bit 13 is cleared at the end of the sampling interval in which it has been set this signal is very short lived and probably not very profitable for monitoring Bit 12 the forward direction flag is meaningful only when the LM628 is in velocity mode The bit is set to logic one to indicate that the desired directio
4. BEEN 1980 National Semiconductor Corporation 20 n Typical Applications continue 4 9219 19 FIGURE 17 PWM Drive for Brushiess Motors PHASE FROM PHASE ENCODER s X 8 umeze 3 4 0524531 3 4 05261532 Rp UNE IMPEDANCE TL H 9219 20 FIGURE 18 Typical Balanced Line Encoder Input Circuit 1080 Semiconductor Corporation 21 n LM628 LM629 Precision Motion Controller Physical Dimensions inches milimeters Lit 107183 313845 ITO 0 638 ang 1 000 009 14 8 24 1838 8 957639 9125 0165 4 stno 97020 09 7 2048102 4 9 4575 0 176 617 2443 28 Lead Moided Package Order Number LM628N 6 LM628N 8 LM629N 6 or 629 8 NS Package Number 288 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 OF NATIONAL SEMICONDUCTOR CORPORATION As used herein 1 Life support devices or systems are devices or 2 A critical component is any component of a systems which a are intended for surgical implant support device or system whose failure to perform can into the body or b support or sustain life and whose be reasonably expected to cause the failure of the life failure to perform
5. Busy Bit Delay WR Pulse Width 100 Write Data Setup Time Write Data Hold Time Write Recovery Time Units o 180 180 Note 2 Note 2 ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns Note 1 Absolute Maximum Ratings indicate limits beyond which damage to the device may occur DC and AC electrical specifications do not apply when operating 2 In order to read the busy bit the status byte must first be read The time required to wad the busy bit far exceeds time the chip requires to set busy bit It is therefore impossible to test busy dit delay The busy bit is guaranteed to be valid soon the user is able to read it 4 i 4 4 D D IN l 5 re INDEX FIGURE 2 Quadrature Encoder Input Timing CLOCK 14 5 4 RESET TL H 8219 5 FIGURE 3 Clock and Reset Timing al 8 00 07 TL H 9219 6 FIGURE 4 Status Byte Read Timing 1989 National Se miconducinr Corporation 4 TL H 901 8 T H 9219 9 FIGURE 7 Data Word Write Timing 1900 National Semiconductor Corporation 5 Pinout Description See Connection Diagrams Pin 1 Index IN input Receives optional index pulse from the encoder Must be tiad high if not used The index posi tion 18 read when Pins 1 2 and 3 are low Pins 2 and 3 Encoder Signal A B Inputs
6. 0 THEN continue ELSE PORT sSets LM628 output port to 12 5115 Only for systems with 12 bit DAC 12 Load Filter Parapeters BUSY Check busy bit LFIL zLoad Filter Parameters command BUSY busy bit WR 0008H Filter Control Word Bits 8 to 15 MSB set the derivative Loading data Leading k data Bit 1 Loading data Bit Leading 11 data sChoose to load kp only at maximum iderivative Sample rate then Filter Control 0008H BUSY sCheck busy bit WR 0032H 100086 50 load data byte pair MS ibyte first Update Filter BUSY sCheek busy bit UDF 1 Load Trajectory Parameters BUSY Check busy bit LTRJ sLead trajectory parameters command BUSY heck busy bit WR 002AH Load trajectory control word See Table I Choose Position mode and load absolute zacceleration velocity and position Then strajectory control word 002AH This means 6 pairs of data bytes should follow Busy Chack busy bit WR XXXXH Load Acceleration integer word MS byte first Busy Check busy bit XXXXH sLoad Acceleration fractional word MS byte first BUSY Check busy bit WR XXXXH sLoad Velocity integer word MS byte first BUSY iCheck busy bit WR XXXXH Load Velocity fractional word MS byte first BUSY Check busy bit WR XXXXH sLoad Position MS byte pair first BUSY Check busy bit WR XXXXH Load position LS byte pair Start Motion BUSY Check busy bit STI sStart command Check for Trajectory complete
7. desired rpm and V 2000 341 6 1 60 600 mm V 6 82 counts sample V scaled 6 82 65 536 446 955 52 V rounded 446 956 value to load V coding 0006D1EC hex code written to LM628 A acceleration units counts sampie sample R T T desired acceleration rev sec sec then A 2000 341 6 341E 6 1 rev sec sec and 233 4 counts sample sample scaled 2 33E 4 65 536 15 24 rounded 15 value to load A coding 0000000F hex code written to LM628 The above position velocity and acceleration values must be converted to binary codes to ba loaded into the LM628 The values shown for velocity and acceleration must be multiplied by 65 536 as shown to adjust for the required integer fraction format of the input data Note that after scaling the velocity and acceleration values literal fractional data cannot be loaded the data must be rounded and con verted to binary The factor of four increase in system reso lution is due to the method used to decode the quadrature encoder signals see Figure 9 PID COMPENSATION FILTER The LM628 uses a digital Proportional Integral Derivative filter to compensate the control loop The motor is held at the desired position by applying a restoring force to the motor that is proportional to the position error plus the integral of the error plus the derivative of the error The following discrete time equation illust
8. pateni licenses are mphed and Nakonai reserves the at ary bme without 10 chenge sad and specshcanona WARRANTY Octagon Systems Corporation Octagon warrants that its stan dard hardware products will be free from defects in materials and workmanship under normal use and service for the current established warranty period Octagon s obligation under this warranty shall not arise until Buyer returns the defective product freight prepaid to Octagon s facility or another specified location Octagon s only responsibility under this warranty is at its option to replace or repair free of charge any defective component part of such products LIMITATIONS ON WARRANTY The warranty set forth above does not extend to and shall not apply to 1 Products including software which have been repaired or altered by other than Octagon personnel unless Buyer has properly altered or repaired the products in accordance with procedures previously approved in writing by Octagon 2 Products which have been subject to power supply reversal misuse neglect accident or improper installation 3 Thedesign capability capacity or suitability for use of the Software Software is licensed on an AS IS basis without warranty The warranty and remedies set forth above are in lieu of all other warranties expressed or implied oral or written either in fact or by operation of law statutory or otherwise including w
9. maximum time to complete RESET tasks is 1 5 ms 12 The RESET default size of the DAC port is eight bits This command initializes the DAC port for a 12 bit DAC It should not be issued in system with an 8 bit DAC Busy bit Check Module 1D RSTI This command resets only the interrupts indicated by zeros in bits one through six of the next data word It also resets bit fifteen of the Signals Register and pin 17 the host interrupt output pin Comments See Initialization Module text Busy bit Check Module Don t 00 LB Zeras in bits one through six indicate interrupts will be reset Busy bit Check Module FIGURE 4 initialization Module with Software Reset Comments Figure 5 illustrates in simplified block diagram form the LM628 The profile generator provides the control loop in put desired shaft position The quadrature decoder pro vides the control loop feedback signal actual shaft position At the first summing junction actual position is subtracted from desired position to generate the control loop error sig nal position error This error signal is filtered by the PID filter to provide the motor drive signal After executing the example initialization module the follow ing observations are made With the integration limit term 4 and the filter gain coefficients kp and initialized to zero the filter gain is zero Moreover after a reset desire
10. Then package in a safe container for shipping Write RMA number on the outside of the box For products under warranty the customer pays for shipping to Octagon Octagon pays for shipping back to customer 7 Other conditions and limitations may apply to international shipments NOTE PRODUCTS RETURNED OCTAGON FREIGHT COLLECT OR WITHOUT AN RMA NUMBER CANNOT BE ACCEPTED AND WILL BE RETURNED FREIGHT COLLECT RETURNS There will be a 15 restocking charge on returned product that is unopened and unused if Octagon accepts such a return Returns will not be accepted 30 days after purchase Opened and or used products non standard products software and printed materials are not returnable without prior written agreement GOVERNING LAW This agreement is made in governed by and shall be construed in accordance with the laws of the State of Colorado The information in this manual is provided for reference only Octagon does not assume any liability arising out of the application or use of the information or products described in this manual This manual may contain or reference information and products protected by copyrights or patents No license is conveyed under the rights of Octagon or others
11. be illustrated by the following example using 500 line 2000 count encoder and an 8 MHz clock LM628 629 giv ing a 256 us sample interval the smallest resolution is 1 count per sample then the minimum velocity would be 2 revolutions per second or 120 rpm 1 2000 revs count x 1 256 ns counts second Many applications require veloci tios and steps in velocity iess than this amount This is pro vided by the fractional counts of acceleration and velocity 16 Bits mu 16 Bils 16 7 Cr 2 7 Position Velocity and Acceleration Resolution Every sample cycle while the profile demands acceleration the acceleration register is added to the velocity register which in turn is added to the position register When the demand for increasing acceleration stops only velocity is added to the position register Only integer values are out put from the position register ta the summing junction and 50 fractional position counts must accumulate over many sample intervals before an integer count is added and the position register changed Figure 6 shows the position ve locity and acceleration registers The pasition dynamic range is derived from the 32 bits of the integer position register Figure 6 Tha MSB is used for the direction sign in the conventional manner the next bit 30 is used to signify when a position called wrap around has occurred If the wraparound bit is set or reset when going in a negative di
12. 513 Sth Floor Av Brig Fara Lima 1383 st Floor 441 St Kida fid 58090 D808 Furglondetdbruck 4 55 Night Shinjuku Chinachem Golden Plaza 6 0 Andor Coni 62 Mehaine 3004 Sante Clara CA 05052 8090 Germany Shin Ku 77 Mody Road Tamehatsui East 01451 Sao SP Brasil Australia Tek 408 721 5000 Tei 081 41 103 0 Tokyo 180 Japan Kowioan Hong Kong 55711 212 5068 03 287 5000 810 239 2240 Telex 527 649 Tet 3 299 7001 3 7231290 Fax 55 13 2411 7187 NSOR 61 3 2677458 Fax 08141 103554 FAX 3 299 7000 Telex 52996 NSSEA Fax 3 3112526 Nationa anes not assume any responsibility for use of any circuitry deseribad no ciant patent censes are implied and National raserves the right at arm time without notice to change said circultty and specifications National Semiconductor March 1989 LM628 LM629 Precision Motion Controller General Description The LM626 LM629 are dedicated motion control proces sore designed for use with a variety of OC and brushless DC servo motors and other servomechanisms which provide a quadrature incremental position feedback signal The parts perform the intensive real time computational tasks re quired for high performance digital motion control The host control software interface is facilitated by high4evel com mand set The LM628 has an 8 bit output which can drive either an 8 bit or 12
13. 5 2 PID Filter Coefficient Scaling Factors tor LM628 629 5 2 1 PID Filter Difference Equation 5 2 2 Difference Equation with LM628 629 Coefficients 5 2 3 LM628 629 PID Filter Output 5 2 4 Scaling for kp and kg 5 2 5 Scaling for kj 5 3 An Exampie of Trajectory Calculation 6 0 QUESTIONS AND ANSWERS 6 1 The Two Most Popular Questions 6 2 More on Acceleration Change 6 3 More on Stop Commands 6 4 More on Define Home 6 5 More on Velocity 6 6 More on Use of Commands 7 0 ACKNOWLEDGEMENTS 8 0 REFERENCES AND FURTHER READING ARD 820M100 Printed in U 5 Jesf 669 891 90 Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figura 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 17 Figure 18 Figure 19 Figure 20 Table 1 List of Illustrations LM628 and LM629 Typical System Block Diagram Hardware Architecture of LM628 629 Quadrature Encoder Output Signals and Direction Decode Table LM628 629 Motor Position Decoder Typical Trajectory Velocity Profile Position Velocity and Acceleration Registers LM628 12 Bit DAC Output Multiplexed Timing LM629 PWM Signal Format Host Inferface Internal 1 O Registers Busy Bit Operation during Command and Data Write Sequence Position vs Time for 100 Count Step Input Basic Software Flow LM628 and LM629 Host Output and Position Encoder Interfaces LM628
14. Status byte is read from command port Pin 16 low and 9 Data is written end read via the data port Pin 16 high Pin 17 Host interrupt K1 Output This active high signal alerts the host via a host interrupt service routine that an interrupt condition has occurred Pins 18 10 25 DAC Port DACO to DAC7 Output port which 15 used in three different modes 1 LM628 8 bit output mode Outputs latched data to the DAC The MSB is Pin 18 and the LSB is Pin 25 2 LM628 12 bit output mode Outputs two multiplexed 6 bit words Tha less significant word is output first The MSB is on Pin 18 and the LSB is on Pin 23 Pin 24 is used to demultiplex the words Pin 24 is low for the less signifi cant word The positive going edge of the signal on Pin 25 is used to strobe the output data Figure 8 shows the timing multiplexed signals 3 LM629 sign magnitude outputsy Outputs a PWM sign Signal on Pin 18 and PWM magnitude signal on Pin 19 Pins 20 to 25 are not used in the LM629 Figure 11 shows the PWM output signal format Connect pin 25 to ground Pin 26 Clock CLK input Receives 6 MHz system clock Pin 27 AST input Active low positive edge trig gered resets the LM628 to the internal conditions shown below Note that the reset pulse must be logic low for a minimum of 8 clock periods Reset does the follawing 1 Filter coefficient and trajectory parameters are zeroed 2 Sets position error threshold
15. This manual is a guide to the proper configuration and operation of the 5328 5328 2 Motion Control Cards Installation instructions card mapping information and jumpering options are described in the main body of the manual technical specifications are included in the appendices The 5328 is a complete motion control unit The 5328 provides an analog feedback signal DAC to the motor controller The 5328 may be used with any Octagon Micro PC Control Card This combination provides a modular system which is easy to set up modify and use You can also use your Motion Control Card in conjunction with other Micro PC expansion cards allowing you to tailor your system for a wide variety of applications All Micro PC products are modular so creating a system is as easy as selecting and plugging in the products you need CONVENTIONS USED IN THIS MANUAL 1 Information which appears on your screen output from your system or commands or data that you key in is shown in a different type face Example 1 Octagon 5025 ROM BIOS Vers X XX Copyright c 1992 1993 Octagon Systems Corp All Rights Reserved Example 2 Press the lt ESC gt key 2 Italicized refers to information that is specific to your particu lar system or program for example Enter filename means enter the name of your file Names of other sections or manuals are also italicized Preface 1 3 Warnings always appear in this format The warning message a
16. not yet be at the final commanded position This bit is the logical OR of bits 7 and 10 of the Signals Register command RDSIGS below The flag functions independently of the host interrupt mask status Bit 2 is cleared via command RSTI Bit 1 the command error interrupt flag is set to logic one when the user attempts to read data when write was ap propriate or vice versa The flag is functional independent of the host interrupt mask status Bit 1 is cleared com mand RSTI Bit 0 the busy flag is frequently tested by the user via the host computer program to determine the busy ready status prior to writing and reading any data Such writes and reads may be executed only when bit 0 is logic not busy Any command or dala writes when the busy bit is high will be ignored Any data reads when the busy bit is high will read the current contents of the 1 port buffers not the data expected by the host Such reads or writes with the busy bit high will not generate command error interrupt RDSIGS COMMAND ReaD SiGnalS Register Command Code OC Hex Bytes Read Two Data Range See Text Executable During Motion Yes The LM628 intemal signals register may be read using this command The first byte read is the more significant The less significant byte of this register with tne exception of bit 0 duplicates the status byte See Table VIII TABLE Vill Signais Register Allocation
17. Gnd PWM Magnitude PWM Sign Encoder Ch A Encoder Ch A Encoder Ch B Encoder Ch B Encoder Index Encoder Index NC NC Function Technical Data 22 APPENDIX LM628 LM629 LM628 AND LM629 DATA SHEETS The material the appendix is copyright 1989 National Semicon ductor Corporation For additional information please refer to Spedal Purpose Linear Devices Databook by National Semiconduc tor or call the Technical Support Department at 303 426 4521 LM628 LM 629 23 This page intentionally left blank LM628 LM629 24 LM628 Programming Guide INTRODUCTION The LM628 LM629 are dedicated motion contral proces sors Both devices and brushless servo mo tors 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 and 2 As indicated in the figures tho LM628 LM623 are bus pe tipherats both devices must be programmed by a host proc essor This application note is intended to present a con crete starting point for programmers of these precision mo tion controllers It focuses on the development of short grams that test overall system functionality and lay the groundwork for more complex programs It also presents method for tuning the loop compensation PID filter t position velocity profile generator digital PiD filter 16 b
18. RDSTAT Check Status Byte bit 2 for trajectory complete Busy bit check routine BUSY RDSTAT Read status byte if bit 0 15 set THEN BUSY ELSE RETURN END Consult reference 5 for more information on programming the LM626 629 FOWER ON RESET HARDWARE RESET READ STATUS REGISTER RESET CORRECT ADDITIONAL RESET CHECK RESET CORRECT FIGURE 12 Basic Software Flow INITIALIZE PORT LOAD FILTER CotFrs LOAD TRAJECTORY PARAMETERS CHECK TRAJECTORY COMPLETE CONTINUE TL H 11018 12 4 0 HELPFUL USER IDEAS 4 1 Getting Started This section outlines the actions that are necessary 10 im plement a simple motion control system using LM628 629 More details how 1 628 629 works and the use of the User Command Set are given in the sections 2 0 DEVICE DESCRIPTION and 3 0 USER COMMAND 4 2 Hardware The following hardware connections need to be made 4 2 1 Host Micracontrolier interface interface to the host microcontroller is via an 8 bit com mand data port which is controlled by four lines These are the conventional chip select CS read write WA and line called Port Select PS see Figure 12 PS is used to select usor Command or trans or between the 1 M628 629 and the host In the special casa of the Status Byte RDSTAT bringing PS CS and AD together allows access this hardware register at any time An optional interrupt line from the LM6
19. Receive the two phase quadrature signals provided by the incremental encoder When the motor is rotating in the positive for ward direction the signal at Pin 2 leads the signal at Pin by 90 degrees Note that the signals at Pins 2 and 3 must remain at each encoder state See Figure 9 for a minimum of 8 clock periods in order to be recognized Because of a four to one resolution advantage gained by the method of decoding the quadrature encoder signals this corresponds to a maximum encoder state capture rate of 1 0 MHz 8 0 MHz or 750 kHz 6 0 MHz For other clock frequencies the encoder signals must also remain at each State a minimum of 8 clock periods Pins 4 11 Host Pori DO to D7 Bi directional data port which connects to host computer processor Used for writing commands and data to the LM628 and for reading the status byte and data from the LM626 as controlled by CS Pin 12 PS Pin 16 RD Pin 13 and WR Pin 15 Pin 12 Chip Select CS input Used to select the LM628 for writing and reading operations Pin 13 Read RD Input Used to read status and data Pin 14 Ground Power supply retum pin Pin 15 Write WR Input Used to write commands and data Pin 16 Port Select PS Input Used to select command or data port Selects command port when low data port when high The following modes are controlled by Pin 16 1 Commands are written to the command port Pin 16 low 2
20. SIP command is exe tho new index position minus the old index position divided by the incremental encoder resolution encoder lines times four should always be an integral number The RDIP command facilitates acquiring these data for host based calculations The command can also be used to iden tify verify home or some other special position The bytes read in most to least significant order RDDP COMMAND ReaD Desired Position Command Code 08 Hex Bytes Read Four Data Range C0000000 to 3FFFFFFF Hex Executable During Motion Yes This command reads the instantaneous desired current temporal position output of the profile generator This is the setpoint input to the positiondoop summing junction The bytes are read in most to least significant order RDRP COMMAND ReaD Real Position Command Code 0A Hex Bytes Read Four Data Range C0000000 to 3FFFFFFF Hex Executable During Motion Yes 1980 Natione Semiconductor Corporation 16 This command reads the current actual position of the mo tor This is the feedback input to the loop summing junction The bytes are read in most to least significant order RDDV COMMAND ReaD Desired Velocity Command Code 07 Hex Bytes Read Four Data Range C0000001 to 3FFFFFFF Executable During Motion Yes This command reads the integer and fractional portions of ihe instantaneous desired current tempora velocity used to generate the desired positio
21. STT COMMAND STarT Motion Control Command Code 03 Hex Data Bytes None Executable During Motion Yes if acceleration has not been changed The STT command is used to execute the desired trajecto the specifics of which have been programmed via the LTRJ command Synchronization of multi axis control to within one sample interval can be arranged by loading the required trajectory parameters for each and every axis and then simultaneously issuing single STT command to amp xes This command may be executed at any time unless the acceleration value has been changed and a trajectory has not been completed or the motor has not been manual ly stopped STT is issued during motion and acceleration has been changed a command error interrupt will be gener ated and the command will be ignored Data Reporting Commands Tha following seven LMG28 user commands are used to obtain data from various registers in the LM628 Status po sition and velocity information are reported With the excep tion of RDSTAT the data is read from the LM628 data port after first writing the corresponding command ta the com mand port 1589 Semiconductor Gorporttion 14 Data Reporting Commands continued RDSTAT COMMAND ReaD STATus Byle Command Code None Byte Read One Deta Range Soe Text Executable During Motion Yes The RDSTAT command is really not a command but is list ed with the other comma
22. bit DAC The components required to build servo system are reduced to the DC motor actuator incremental encoder DAC a power amplifier and the LM628 An LM629 based system is similar except that it provides an 8 bit PWM output for directly driving H switches The parts are fabricated in NMOS and packaged in 26 pin dual in line package and are offered in both 6 MHz and 8 MH2 maximum frequency versions The suffixes 6 and 8 respectively used to designate version They rate an SDA core processor and celis designed by SDA Connection Diagrams LM628 TL H 9219 2 Features B 32 bit position velocity and acceleration registers Programmable digital PID fiter with 16 bit coefficients Programmable derivative sampling interval 8 or 12 bit DAC output data LM628 Sbit sign magnitude PWM output data LM629 intemal trapezoidal velocity profile generator Velocity target position and filter parameters may be changed during motion Position and velocity modes of operation E Real time programmable host interrupts 8 bit parallel asynchronous host interface 8 Quadrature incremental encoder interface with index pulse input TRLGTATE i a registered tmdemart of National B4miconduct Corpomton TL H 9219 1 FIGURE 1 Typical System Block Diagram L M629 2 SIGH AARBSERLRRS
23. byte will still reflect the ac tual conditions independent of the mask byte See Table IH TABLE Mask and Reset Bit Allocations for interruptis Bits 15 thru 7 Not Used Bit 6 Breakpoint Interrupt Bit5 Position Error Interrupt Wrap Around Interrupt Index Pulse interrupt Trajectory Complete interrupt Command Error Interrupt Bit 4 Bit3 Bit2 Bit1 sito RSTI COMMAND ReSeT interrupis Command Code 10 Hex Data Bytes Two Oata Range See Text Executable During Motion Yes When one of the potential interrupt conditions of Tabie occurs command RSTI is used to reset the corresponding interrupt flag bit in the status byte The host may reset one or all flag bits Resetting them one at a time allows the host to service them one at a time according to a priority grammed by the user As in the MSKI command bits 1 through 6 of the second less significant byte correspond to the potential interrupt conditions shown in Table Ill Also see description of ROSTAT command Any zero s in this 6 bit field reset the corresponding interrupt s The remain ing bits have no effect Filter Control Commands The following two LM628 user commands are used for set ting the derivative term sampling interval tor adjusting the fitter parameters as required to tune the system and to con trot the timing of these system changes LFIL COMMAND Load Filter Parameters Command Code Hex Data Bytes Two to Ten Data Rang
24. coefficient Kp and k values is to use tuning as described in Section 2 11 some users may want to use more theoretical ap proach to at least find initial starting values before fine tun ing As very often this analysis is performed in the continu ous 5 domain and transformed into the discrete digital do main for implementation the retationship between the con tinuous domain cosfficients and the values input into 1M628 629 is of interest 5 2 1 PID Filter Difference Equation in the discrete domain equation 1 becomes the difference equation N KT Mene slein enn e nud Where is the sample interval 2046 fci T is the derivative sample interval 2048 X 1 255 5 2 2 Difference Equation with LM628 629 Coefficients In terms of LM628 629 coefficients 2 becomes Where and are the discrete time LM628 629 cients e n is the position error at sample time n indicates sampling at the derivative sampling rate The error signat etn or e n is a 16 bit number from the outpul of the summing junction and is the input to the PID The 15 bit filler coefficients are respectively multiplied by the 16 bit error terms shown in equation 3 to duce 32 bit products 5 2 3 LM620 629 PID Filter Output The proportional coefficient kp is multiplied by the error sig nal directly The error signat is continually summed at the sample to
25. eim or MEE bita wey L 31 bits eee output 12 38 autput TL H 11018 18 FIGURE 18 Scaling of kp and ky 19 Result kp x 256 Kp x e n 256 Similarly for kg Result 0 e n 1 256 x e n 256 Where T the derivative sampling rate 5 2 5 Sealing for k Figure 19 shows the multiplication and output for the inte gral term The use of a 24 bit register tor the error terms summation givas further scaling Result k 256 gt 256 Ki x T kj 65536 K x T Where is the sampling interval 2048 1 For 12 bit output the factors are kp 16 X Kg kg 16 and 4096 x if the 32 bit result register overflows into the most significant 16 bits as a result of a calculation then all the lower bits are set high to give a predictable saturated output 5 3 An Example of a Trajectory Calculation Problem Determine the trajectory parameters for a motor of 500 revolutions in 1 minute with 15 seconds of acceleration and deceleration respectiveh Assume the op tical incremental encoder used has 500 fines The LM628 629 quadrature decoder gives four counts for each encoder line giving 2000 counts per revolution in this The total number of counts for this position move is 2000 500 1 000 000 count
26. follows 1 The derivative sampling coefticient dg is set to one and all other filter coefficients and filter coefficient input buff ers are set to zero With ds set to one the derivative sampling interval is set to 2048 fc 2 All trajectory parameters and trajectory parameters input buffers are set to zero 3 The current absolute position of the shaft is set to zero home 4 The breakpoint interrupt is masked disabled and the remaining five interrupts are unmasked enabled 5 The position error threshold is set to its maximum value 7FFF hex 6 The DAC output port is set for an 8 bit DAC interface Flow diagram 2 illustrates a hardware reset block that in cludes an LM628 functionality test This test shouid be com pleted immediately following all hardware resets Flow Diagram 2 Hardware Reset Block Strobe RST pin 27 logic iow for 8 clock periods minimum Read the Status Byte Status Byte 0 or 80 Wait 1 5 ms after RST logic level returned high reset execution time Read the Status Byte Status Byte C4 or 84 Reset interrupts Reset Interrupts An RSTI command sequence allows the user to reset the interrupt bits bits one through six of the status byte See Table contains an RST command and one data word The RSTI command initiates resetting the interrupt fiag bits Command RSTI also resets the host interrupt output pin pin 17 TL H 10860 5
27. of each of the PID filter coefficients should be understood The following is very brief review tor a detailed understanding reference 2 should be consulted The proportional coefficient kp pro vides adjustment of the control system loop proportional gain as this is increased the output steady state error is reduced The error between the required and actual position is effectively divided by the foop gain However there is natural limitation on how far can be increased on its own to reduce output position error because a reduction in phase margin is also consequence of increasing kp This is first encountered as ringing about the final position in sponse to a step change input and then instability in the form of oscillation as tha phase margin becomes zero improve stability ka the derivative coefficient provides a damping effect by providing a term proportional to velocity in antiphase 10 the ringing or viewed in another way adds some leading phase shift into the and increases the phase margin in the tuning process the coefficients and kg are iterative ly increased to their optimum values constrained by the sys tem constants and are trade offs between response time stability and final position error When and have been determined the integral coefficient ki be introduced to remove steady state errors at the load The steady state errors removed are the velocity lag tha
28. of offering maxmum possibie decoder bandwidth Attempting to drive encoder signals too long a distance with simple TTL lines can also be a source of noise in the form of signal degradation poor risetime and or ringing This can also cause a system to lose positional integrity Probably the most effective countermeasure to noise induction be had by using bal ancad ine drivers and receivers on the encoder inputs Fig ute 18 shows circuitry using the 05261 531 and DS26LS32 91289 Natonal Semiconductor Corporation Typical Applications Continued 4201 RN A B 1 Note 1 20V R1 x R2 3 22 25 8 NOTE At ENCODER E M MOTOR TLIN 9219 14 FIGURE 12 Host interface and Minimum System Configuration ADDRESS _ DECOOER eg HC138 TL H 9219 15 FIGURE 13 LM628 and HPC Interface 6 1980 Nations Semiconductor Corporation 18 Typical Applications Continued TL H 0219 16 FIGURE 14 Interfacing a 12 81 DAC and LM628 offset must be adjusied ta minimize DAC linearty and monotonicity errors See text IMMER PHP 1080 National Semicontuctor Corpomiion 19 w Typical Applications continues TL H 9219 17 FIGURE 15 Driving a Motor with the LM12 Power Op Amp MOTOR SuPPLY VOLTAGE PIN 18 SIN FROM 14529 PN 19 MAG TL H 9219 18 FIGURE 16 PWM Drive for Brush Commutator Motors
29. previously accumulated errors to form the integral signal and is maintained to 24 bits To achieve a usable range from this term only the most significant 16 bits are used and multiplied by the integral coefficient The absolute value of this product is compared with the integration limit i and the smallest value appropriately signed is used To form the derivative signal the previous error is subtracted from the current eror over the derivative sampling interval This is multiplied by the derivative coetfi cient kg and the product contributes every sample interval to the output independently of tha user chosen derivative sample interval The feast significant 16 bits of the 32 bit products from the three terms aro added together to produce the resulting u n of equation 3 each sample interval From the PID filter 16 bit result either the most significant 8 or 12 bits are output depending on the output word size being used A conse quence of this and the use of the 16 MSB s of the integral signal is a scaling of the filter coatficients in relation to the continuous domain coefficiants 5 2 4 Scaling for kp and Figure 18 gives details of the multiplication and output for kp and kg Taking the output from the MS byte of the LS 16 bits k X kgle n etn 0i o of the 32 bit result register causes an effective 8 bit right n 0 shift or division of 256 associated with kp and as follows
30. problems with the software This causes frustration for the customer and incurs a testing charge from Octagon m Of the remaining 80 of the cards 90 of these cards fail due to customer misuse and accident Customers often cannot pinpoint the cause of the misuse Therefore 72 of the returned cards are damaged through some type of misuse Of the remaining 8 Octagon is unable to determine the cause of the failure and repairs these cards at no charge if they are under warranty The most common failures on CPU cards are over voltage of the power supply static discharge and damage to the serial and parallel ports On expansion cards the most common failures are static discharge over voltage of inputs over current of outputs and misuse of the CMOS circuitry with regards to power supply sequencing the case of the video cards the most common failure is to miswire the card to the flat panel display Miswiring can damage both the card and an expensive display m Multiple component failures The chance of a random component failure is very rare since the average MTBF of an Octagon card is greater than 11 years In a 7 year study Using CMOS Circuitry 2 Octagon has never found a single case where multiple failures were not caused by misuse or accident It is very probable that multiple component failures indicate that they were user induced Testing dead cards For a card that is completely nonfunctional t
31. the output staying at the value of the previous sample For this reason it is recom mended that trajectory is not updated at a greater rate than once every 10 ms 5 0 THEORY 5 1PID Filter 5 1 1 PID Filter in the Continuous Domain The LM628 629 uses a PID filter as the loop compensator the expression for the filter in the continuous domain is Kgs 0 Where proportional coefficient integral coefficient Kg derivative coefficient Ko Kd 2 FREQUENCY FREQUENCY FIGURE 17 Bode Plots of Transfer Function TL H 11018 17 The Bode plots for this function shown Figure 77 snow the effect of the individual terms of equation 1 The tional term Ky provides adjustment of proportional gain The derivative term increases the system bandwidth but more importantly adds leading phase shift to the control at high frequencies This improves stability by counter acting the lagging phase shift introduced by other control loop components such as the motor The integral term provides a high OC gain which reduces static errors but introduces lagging phase shift at frequencies The rel ative magnitudes of Ky and proportional gain have to be adjusted to achieve optimum pertormanca without in troducing instability 5 2 910 Fitter Coefficient Scaling Factors for LM628 529 While the easiest way to determine the PID filter
32. those previ ously loaded All trajectory values are 32 bit values position values are both positive and negative Velocity and acceler ation are 16 bit integers with 16 01 fractions whose absolute valus is always positive When entering relative values on sure that the absolute value remains positive The commands bits 8 9 and 10 are intended to alow an unprogrammed stop in position mode while a position move is in progress perhaps by the demand of some external event and to provide a method to stop in velocity mode They do not specify how the motor will stop in position mode at the end of normal position move position mode a programmed move will automatically stop with a deceleration rate equal to the acceleration rate at the target position Setting a stop bit along with other trajectory param eters at the beginning of a move will result in no movement Bits 8 9 and 10 should only be set one at a time bit B turns the motor off by outputting zero drive to the motor bit 9 stops the motor at maximum deceleration by setting the tar get position equat to the current position and bit 10 stops the motor using the current user programmed acceleration value Bit 11 is set for operating in velocity mode and bit 12 is set for forward direction in velocity mode Critically Damped 7 1111 111 i Li LII ILI 11 1 LL 10 ms div 10 ms TL H tIO1B 1 FIGURE 11 Position
33. to maximum value 7FFF hax and effectively executes command LPEI 3 The SBPA SBPR interrupt is masked disabled 4 The five other interrupts are unmasked enabled 5 Initializes current position to zero or home position 6 Sets derivative sampling interval to 2048 1 or 256 us for an 8 0 MHz clock 7 DAC port outputs 800 hex to zero a 12 bit DAC and then Lo 80 hex to zero an 8 bit DAC immediately after releasing the reset pin from the LM628 the status port should read 907 If the reset is successfully completed the status word will change to hex 84 or Ca within 1 5 ms If the status word has not changed from hex 00710 84 or C4 within 1 5 ms perform another reset and repeat the above steps To be certain that the reset was properly performed execute a RSTI command If the chip has reset properly the status byte will change from hex 84 or C4 to hex 80 If this does not occur perform another reset and repeat the above steps Pin 28 Supply Voltage Power supply voltage 5 2048 Genes 18223 D 5104 eas SELECT PIN 24 STROBE PIN 25 Terk TL H 9219 10 FIGURE 8 12 Bit Multiplexed Output Timing MEN 1989 National Semiconductor Corporation 6 Theory of Operation INTRODUCTION The typical system block diagram See Figure 7 illustrates servo system built us
34. tothe MOTOR AMPLIFIER 1 Install the card in the Micro PC system as described in the previous chapter 2 Turn on and boot the Micro PC system with the 532x card 3 Turn on power to the motor amplifier The motor should be stationary but freewheeling You should be able to turn the motor with little resistance it should stay at any position you leave it Loop Phasing 15 Run the demonstration program supplied with the 532x card Answer all questions appropriately until the following message is displayed Controller initialization complete The motor should be stationary but may be slowly rotating due to amplifier offset If the motor immediately accelerates at high speed shut the motor amplifier power off A loop inversion may exist Go to step 7 If the motor slowly rotates the amplifier offset may be nulled by adjusting potentiometer R2 for channel one or R4 for channel two Slowly adjust the potentiometer until the motor is stationary If while you are adjusting the potentiometer the motor suddenly accelerates at high speed a loop inversion exists Shut the motor amplifier power off and go to step 7 Keep clear of the motor shaft and any attached loads Carefully attempt to turn the motor shaft If the motor suddenly accelerates at high speed a loop inversion exists Shut the motor amplifier power off and go to step 7 If the loop phasing is correct the motor should feel as if it were spring loa
35. transfer the next byte pair when transferring multiple words Data transfers are accomplished via LM626 intemal interrupts which are not nested the busy bit informs the host processor when the LM628 may not be interrupted for data transfer or command byte If command is written The _ 629 provides 8 bit sign and magnitude PWM output signals for directly driving switch mode motor drive ampiifi ers Figure 11 shows the format of the PWM magnitude out put signal bum MAGNITUDE WAVEFORUS 19 0 _ 1 when the busy bit is high the command will be ignored 4 The busy bit goes high immediately after writing a command rom ff f d byte or reading or writing a second byte of data See Fig 256 ures 5 thru 7 MOTOR OUTPUTS 21 33 ww LI LILI LS The LM628 DAC output port can be configured to provide sor either a latched eight bit parallel output or multiplexed T ia 12 bit output The 8 bit output can be directly connected to te 122 wt flow through non input latching D A converter the 12 bit La T Output can be easily demultiplexed using an external 6 04 Tex latch and an inputJatching 12 bit D A converter The DAC MA veg output data is offset binary coded the 8 bit code for zero is 80 hex and the 12 bit code for zero is 800 hex Values less than these cause a negative torque to be applied to the motor and conversely larger values c
36. vs Time for 100 Count Step input 10 Following immediately after the trajectory contro word shoutd be two 16 bit data words for each parameter speci fied 10 be loaded These should be in the descending order of the trajectory control word bits that is acceleration ve locity and position They are written to the LM628 629 as two pairs of data bytes in most to least significant byte or der The busy bit should be checked between the command byte and the data byte pair forming the trajectory contro word and the individual data byte pairs of the data The Start command STT transfers the loaded trajectory data into the working registers of the double buffered scheme to initiate movement of the motor This buffering allows any parame ter except acceleration to be updated while the motor is moving by loading data with the LTRJ command and to be later executed by using the STT command New values of acceleration can be loaded with LTRJ while tha motor is moving but cannot be executed by the STT command until the trajectory has completed or the drive to the motor is turned off by using bit 8 of the trajectory control word If acceleration has been changed and STT is issued while the drive to the molor is still present a error interrupt will be generated and the command ignored Sepa rate pairs of LTRJ and STT commands should be issued to first turn the motor off and then update acceleration System operation when ch
37. 0 24 FIGURE 25 The Step Response of an Under Damped Control System SV div 100 mSEC div Trigger Signal Step Response TL H 1086025 FIGURE 26 The Step Response of an Over Damped Control System T 5V div 100 mSEC div Trigger Signal Step Response TL H 10860 26 FIGURE 27 The Step Response of a Criticaily Damped Control System 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 PHESIDENT OF NATIONAL SEMICONDUCTOR CORPORATION As used herein 1 Life support devices or systems are devices or 2 A critical component is any component of a systems which a are intended for surgical implant Support device or system whose failure to perform can into the body or b support or sustain life and whose be reasonably expected to cause the failure of the life failure to perform when properly used in accordance support device or system or to affect its safety or with instructions for use provided in the labeling can effactiveness be reasonably expected to result in a significant injury to the user National Semiconductor National Semiconductor Matonat Semiconductor Nationat Semiconductor Nations Semicondutores National Semiconductor 2 Gmbti Japan Lt Hong Kong Ltd Do Brasi Lisa PTY ttet 2900 Semiconductor Drive Industriestrasse 10 Sanseido Big SE
38. 1 SIT STT must be issued to execute the desired trajectory FIGURE 13 Simple Absolute Position Move Program SIMPLE RELATIVE POSITION MOVE This program demonstrates the programming flow required to load and execute a relative position move See Figure 14 Move Independent of the current resting position of the shaft the shaft will complete thirty revolutions in the reverse direction Total time to complete the move is fifteen sec onds Total time for acceleration and deceleration is five seconds Note Target position is the final requested position If the shaft is stationary and motion has not been stopped with motor off stop module tha current absolute position of the shaft is the target posilion If motion has been stopped with a motor off stop module or position has begun the absolute position that corresponds to the endpoint of the current trajectory is the target position Relative position is posi lion measured relative to the current target position of the shaft relative position move is a move thal ends the specified relative number of counts away from the current target position of the shaft For example if the current target position of the shaft is 10 counts and a relative positian of 30 000 counts is specified upon compietion of the move the absolute position of the shaft will be 30 010 counts i e 30 000 counts relative to 10 counts Load Trajectory Parameters The first byte of th
39. 28 629 to tha host can be used A microcontrolier output line is necessary to control the 1 628 629 hardware reset action 4 2 2 Position Encoder Interface The two optical incremental position encoder outputs feed into the LM628 629 quadrature decoder TTL inputs A and The leading phase the quadrature encoder output de fines the forward direction of the motor and should be con nected to input A Optionally an index pulse may be used from the position encoder This is connected to the IN input which should tied high if used see Figure 13 4 2 3 Output interface LM628 has a parallel output of either B or 12 bits the latter is output as two multiplexed 6 words Figure 14 illustrates how motor might be driven using LM12 power linear amplifier from the output of 8 bit LM629 has a sign and magnitude PWM output Figure 13 of 7 bit resolution plus sign Figure 75 shows how the LM629 sign and magnitude outputs can be used to control the out puts of LM18293 quad half H driver Tha hall H drivers are used in pairs by using 100 mf current sharing resistors and form a full H bridge driver of 2A output The sign bit is used 10 steer the PWM LM629 magnitude output to either side of the H bridge lower output transistors while holding the upper transistors on the opposite side of the H bridge continuously on OPTICAL POSITION ENCODER INTERFACE TL H 11018 13 FIGURE 13 LM628 and LM629 Host O
40. 5328 User s Manual Doc 02794 Rev 0198 OCTAGON SYSTEMS CORPORATION 6510 W 91st Ave Westminster CO 80030 Tech Support 303 426 4521 COPYRIGHT Copyright 1990 93 1998 Octagon Systems Corporation All rights reserved However any part of this document may be reproduced provided that Octagon Systems Corporation is cited as the source The contents of this manual and the specifications herein may change without notice TRADEMARKS Micro PC PC SmartLink Octagon Systems Corporation the Octagon logo and the Micro PC logo are trademarks of Octagon Systems Corporation QuickBASIC is a registered trademark of Microsoft Corporation NOTICE TO USER The information contained in this manual is believed to be correct However Octagon assumes no responsibility for any of the circuits described herein conveys no license under any patent or other right and makes no representations that the circuits are free from patent infringement Octagon makes no representation or war ranty that such applications will be suitable for the use specified without further testing or modification Octagon Systems Corporation general policy does not recommend the use of its products in life support applications where the failure or malfunction of a component may directly threaten life or injury It is a Condition of Sale that the user of Octagon products in life support applications assumes all the risk of such use and indemnifies Octag
41. 60 7 low byte Breakpoint Wrap Trajectory Interrupt around Complete Interrupt Interrupt TL H 10860 8 DAC Port Size During both hardware and software resets the DAC output port defaults to 8 bit mode if an LM628 control loop utilizes 12 08 DAC command PORT12 should be issued immedi ately following the hardware reset block and all subsequent resets Failure to issue command PORT12 will result in er ratic unpredictable motor behavior if the control loop utilizes an B bit DAC command PORT 12 must not be executed this too will result in erratic unpre dictable motor behavior An LM629 will ignore command PORTS as it provides an 8 bit sign magnitude PWM output Command PORT12 should not be issued LM629 based systems Software Reset Considerations After the initial hardware reset resets can be accomplished with either a hardware reset or command RESET software reset Software and hardware resets execute the same taskst and require the same execution time 1 5 ms maxi mum During software reset execution the LM628 wili ig nore any commands or attempts to transfer data The hardware reset module includes an LM628 functionality test This test is nof required after a software reset Figure 4 details an initialization module that uses a software reset tin the case of a software reset the position error threshold remains at its pre reset value Port Bytes Command 00
42. 9 Typical System Block Diagram 1 628 629 is itself a purpose designed microcontroller that implements a position decoder a summing junction a digital PID loop compensation filter and a trajectory profile genar ator Figure 1 Output format is the only difference between LM628 and LM629 A parallel port is used to drive an 8 12 bit digital to anaiog converter trom the LM amp 28 while the LM629 provides a 7 bit plus sign PWM signal with sign and magnitude outputs interface to the host microcontroiler is via an 8 bit bi directional data port and six contro lines which includes host interrupt and hardware reset Maximum sampling rates of either 2 9 kHz or 3 9 kHz are available by choosing the LM6268 9 device options that have 6 MHz or B MHz maximum clock frequencies device 6 or 8 suffixes In operation to start a movement a host microcontroller downloads acceleration velocity and target position values to the LM628 629 trajectory generator At each sample in terval these values are used to calculate new demand or set point positions which are fed into the summing junc lion Actual position of the motor is determined trom the output signals of an optical incremental encoder Decoded by the LM628 629 s position decoder actual position is fed CER PLA AND TO HOST to the other input of the summing junction and subtracted from the demand position to form the error signal input for the control loop compensator T
43. ALLATION This chapter contains the basic information you need to install your Motion Control Card There are four basic steps involved setting the base address selecting the interrupt request line connecting external equipment and installing the motion control card in the card cage The instructions in this section apply to all Micro PC Motion Control Cards The expansion card uses one slot of the Micro PC card cage It may be used with any Micro PC Control WARNING Power should be OFF and card cage UN PLUGGED while you insert the card into the card cage Failure to do so may cause damage to the Control Card the Motion Control Card and or the User The card contains static sensitive CMOS components The greatest danger occurs when the card is plugged into a card cage It becomes charged by the user and the static discharges to the backplane from the pin closest to the card connector If that pin happens to be an input pin even TTL inputs may be damaged To avoid damaging your card and its components 1 Ground yourself before handling the Motion Control Card 2 Disconnect power before removing or inserting the Card Installation 7 EQUIPMENT You will need the following equipment or equivalent to use your expansion card 5328 Motion Control Expansion Card e Micro PC Control Card e Micro PC Power Module Card Cage SmartLINK or other serial communications software if your system
44. Check Module HB Velocity is loaded in two data LB words These two bytes are the high data word tn this case velocity is 161 087 counts sample Busy bit Check Module HB velocity data word low LB Busy bit Check Module HB Position is loaded in two data LB words These two bytes are the high data word In this case the position loaded is 120 000 counts This resutts in a move of thirty revolutions in the reverse direction Busy bit Check Module HB position data word low LB Busy bit Check Module STT STT must be issued to execute the desired trajectory FIGURE 14 Simple Relative Position Move Program counts sample Velocity 48 828 58 594 t samplas 2 548 TLAH 10860 15 FIGURE 15 Velocity Profile for Simple Relative Position Move Program The number of samples while at maximum velocity is deter mined 10 SECONDS number of samples while at 39 062 SAMPLES H 256 x 19 6 SECONDS maximom velocity SAMPLE Using the total counts traveled while at maximum velocity and the number of samples while at maximum velocity ve locity is determined 96 000 COUNTS _ pg COUNTS 39 062 SAMPLES SAMPLE Both acceleration and velocity values are scaled COUNTS COUNTS 000252 290415 65 536 16 515 s COUNTS COUNTS 2458 goms 65 596 161 087 488 Acceleration and velocity are rounded 10 the nearest integer and all three trajectory parameters are conver
45. DSTAT This command resets only the interrupts indicated by zeros in bits one through six of the next data word It also resets bit fifteen of the Signals Register and the host interrupt pin pin 17 don t LB Zeros in bits one through six indicate all interrupts will be reset This wait block inserts a delay between repetitions of the step input The delay application specific but a good range of values for the delay is 5 ms to 5000 ms Loop back to STT decision RSTI wait LOOP FIGURE 23 Step Generation Section Filter Tuning Program 18 Hardware Considerations For a motor control system an oscilloscope trace of the system step response is a graph of the real position of the shaft versus time after a small and instantaneous change in desired position For LM628 based system extra hardware is needed to view the system step response During a step the volt age across the motor represents the system step response and an oscilloscope is used to generate a graph of this re sponse voltage For an LM629 based system extra hardware is needed to view the system step response Figure 24 illustrates a circuit for this purpose During a step the voltage output of this circuit represents the system step response and an oscillo scope is used to generate a graph of this response The oscilloscope trigger signal a rectangular pulse train is taken from the host inte
46. Department Technical Assistance Carefully recheck your system before calling the Technical Support Department Run as many tests as possible the more information you can provide the easier it will be for the Technical Support staff to help you solve the problem For technical assistance please call 303 426 4521 Installation 13 This page intentionally left blank Installation 14 3 LOOP PHASING In order for the servo controller to operate properly it should generate a motor command output DAC for the 5328 of the correct polarity to keep the motor at its desired position If the motor deviates from that position and the motor command output polarity is reversed the motor command output will push the motor away from its desired position instead of toward it The result is motor runaway where the motor accelerates at high speed Ensuring that the motor command output polarity is correct is called loop phasing WARNING DO NOT turn on the power to the motor amplifier until instructed to do so When turning on the system apply power to the Micro PC system FIRST then turn on power to the motor amplifier When shutting down the system turn off the motor amplifier then the Micro PC system Keep clear of the motor and any attached loads during the following procedure 11 a loop inversion problem exists the motor will accelerate at high speed Should this happen be prepared to SHUT OFF POWER
47. Example of Linear Motor Drive using LM12 LM629 H Bridge Motor Drive Example using LM18293 Generating a Non Trapezoidal Profile Bode Plots of PiD Transfer Function Scaling for and Scaling tor k Trajectory Caiculation Example Profile Trajectory Control Word Bit Allocations 1 0 INTRODUCTION 1 1 Application Note Objective This application note is intended to explain and complement the information in the data sheet and also address the com mon user questions While no initial familiarity with the LM628 629 is assumed it will be useful to have the 1 628 629 data sheet close by to consult for detailed d scriptions of the user command set timing diagrams bit assignments pin assignments etc After the following brief description of the LM628 629 Sec tion 2 0 gives a fairly full description of the device s opera tion probably more than is necessary to get going with the device This section ends with an outline of how to tune the controi system by adjusting the PID filter coefficients Section 3 User Command Set discusses the use of the LM628 629 commands For a detailed description of each command the user should refer to the data sheet Section 4 Helpful User tdeas starts with a short descrip tion of the actions necessary get going then proceeds to talk about some performance enhancements and follows on with a discussion of a couple ot operating constraints of the device 628 or LM629 Se
48. R USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF NATIONAL Lit 100706 2 critical component is component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system or to affect its safety or effectiveness to the user Semiconductor Semiconductor _ National Semiconductor National Semiconductor National Semicendutores National Semiconductor Corporation Japan Ltd Hong Kong Ltd De Brasi Ltda PTY 16 2900 Semconductor Orve 10 Sansmdo Bldg SF 513 5th Floor Bing Fane 1383 tsi Floor 441 1 Rd PO Box 58090 0 6080 Furstenteldbruck 4 15 Chwachem Plaza 6 0 Andor Conj 62 Metbourne 3004 95052 20 West Germany Ku 17 Road Easi 01457 Sao SP Victory Austral Tet 408 721 5000 Tal 0 81 41 102 0 Tokyo 160 Japan Kowlocn Hong Kong 55 11 212 5066 03 267 5000 Twi 950 239 9240 527 849 Tat 3 290 7001 3 7231290 Fax 55 11 211 118 NSBR Fax 61 3 2677460 Fas 06141 109564 FAX 3 298 7000 Telex 52996 NSSEA Fax 3 31125 does assume any responsivity for use of any orcutry described no
49. SIP causes bit 3 of the status byta to be set whan the absolute position of the next index pulse is recorded in the index register This can be read with the command Read Index Position RDIP Executing either Load Position Error for Interrupt LPEI Load Position Error for Stopping LPES commands sets bit 5 of the Status Byte when a position error exceeding a specified limit occurs An excessive position error can indi cate a serious system problem and these two commands give the option when this occurs of either interrupting the host or stopping the motor and interrupting the host The excessive position is specified following each command by a data byte pair in most to least significant byte order Executing either Set Break Point Absolute SBPA or Set Break Point Relative SBPR commands sets bit 6 of the status byte when either the specified absolute or relative breakpoint respectively is reached The data for SBPA can be the full position range hex CO000000 to 3FFFFFFF and is sent in data byte pairs in most to least significant byte order The data for the Set Breakpoint Relative com mand is also of two data byte pairs but its value should be Such that when added to the target position it remains within the absolute position range These commands can be used to signal the moment to update the on going trajectory or filter coefficients This is achieved by transferring data from the primary registers previously loaded
50. Two Data Range 00000 Hex to the Current Value of the Integration Limit Executable During Motion Yes This command reads the value to which the integration term has accumulated The ability to read this value may be help ful in initially or adaptively tuning the system Typical Applications Programming LM628 Host Handahaking Interrupts A few words regarding the LM628 host handshaking will be helpful to the system programmer indicated in various portions of the above text the LM628 handshakes with the host computer in two ways via the host interrupt output Pin 17 or via poliing the status byte for interrupt conditions When the hardwired interrupt is used the status byte is also read and parsed to determine which of six possible condi tions caused the interrupt Typical Applications continued When using the hardwired interrupt It is very important that the hoet interrupt service routine does not interfere with a command sequence which might have been in progress when the interrupt occurred if the host interrupt servica rou tine were to issus command to the LM628 while it is in the middie of an ongoing command sequence the ongoing command will be aborted which could be detrimental to the application Two approaches exist for avoiding this problem If one is using hardwired interrupts they should be disabled at the host prior to issuing any LM628 command sequence and re enabled after each command s
51. a quadrature incremental sig nal to determine the absolute position of the shaft Velocity RPS 92 0 1 RPS 1 6 revolutions traveled while at maximum velocity 1 4 1 1 2 12 t seconds TL H 10860 13 FIGURE 10 Velocity Profite for Simple Absolute Position Move Program ONE POSITIVE i ENCODER LINE DIRECTION NEGATIVE at La INDEX TL H 10860 14 FIGURE 11 3 Channel Quadrature Encoder Signals The resolution of a quadrature incremental encoder is usu ally specified as a number of fines This number indicates the number of cycles of the output signals for each com plete shaft revolution For example an N line encoder gen erates cycles of its output signals during each complete shaft revolution By definition two signals that are in quadrature are 90 out of phase When considered together channels A and B Figure 11 traverse four distinct digital states during each full cycle of either channel Each state transition represents one count of shaft motion The leading channel indicates the direction of shaft rotation Each line therefore represents one cycle of the output sig nals and each cycle represents four encoder counts COUNTS 77 REVOLUTION CYCLES a REVOLUTION CYCLE The reference system uses a one thousand line encoder CYCLES counts COUNTS REVOLUTION CYCLE REVOLUTION
52. aft may rotate slowly but with minimal torque capability Initially should be set below twenty ds should be set to one and kg and should remain at zero These values will not provide optimum system performance but they will be sufficient to test system functionality See Tuning the PID Filter TRAJECTORY PROGRAMMING MODULE Figure 7 details the example trajectory programming mod ule Load Trajectory Parameters An LTRJ Load TRaJectory command sequence includes command a trajectory control word and a variable number of data words The LTRJ command initiates loading trajectory parameters into input buffers The two data bytes written immediately after LTRJ com prise the trajectory control word The first byte programs with logical ones in respective bit positions the trajectory mode velocity or position velocity mode direction and stopping mode See Stop Module The second byte indi cates with logical ones in respective bit positions which of the three trajectory parameters will be loaded It also indi cates whether the parameters are absolute or relative See Table V Any combination of the three parameters can be loaded within a single command sequence Immediately following the trajectory control word the trajec tory parameters are written Each parameter is written as a pair of data words four data bytes Because any combina tion of the three parameters can be loaded within singl
53. ance s at2 2 is traveled due to acceleration a and time t Theretore acceleration 25 12 2 X 166 667 58 600 97 1 x 10 6 counts sample Acceleration and velocity values are entered into LM628 629 as a 32 bit integer double word but represents 16 bit integer plus 16 bit fractional value To achieve this acceleration and velocity decimal values are scaled by 65536 and any remaining fractions discarded This value is then converted to hex to enter into LM628 in four bytes Scaled acceleration a 97 1 x 10 6 x 65536 6 36 decimal 00000006 hex The maximum velocity can be calculated in two ways either by the distance in counts traveled at maximum velocity di vided by the number of samples or by the acceleration mul tiplied by the number of samples over acceleration duration as follows Velocity 666 667 117 200 97 1 X 10 6 x 58 600 5 69 counts sample Scaled by 65536 bacomes 372 899 8 decimal 00058042 Inputting these values for acceleration and velocity with the target position of 1 000 000 decimal 00024240 hex will achieve the desired velocity profile 6 0 QUESTIONS AND ANSWERS 6 1 The Two Most Popular Questions 6 1 3 Why doesn t the motor move I ve loaded filter pa rameters trajectory parameters and issued Update Fil ter UDF and Start STT commands Answer The most like cause is that a stop bit one of bits 8 9 or 10 of the trajectory control word has been set in error supposedly to cause a s
54. anging acceleration while the motor is moving but with the drive removed is discussed in Section 4 5 1 3 4 Loading Filter Coefficients PIO filter coefficients are ioaded using the Load Filter Pa rameters LFIL command and are the proportional coeffi cient kp derivative coefficient kg and integral coefficient Associated with kj an integration limit il has to be loaded This constrains the magnitude of the integration term of the PID filter to the il value see Saction 4 4 2 Associated with the derivative coefficient a derivative sample rate can be chosen from 2048 to 2048 256 steps of 2048 sea Section 4 4 1 The first pair of data bytes fallowing the LFIL command byte form the filter control word The most significant byte sets the derivative sample rate the fastest rate 2048 c be ing hex 00 the slowest rate 2048 x 256 hex FF The tower four bits of the least significant byte tell the LM628 629 which of the coefficients is going to be load ed bit 3 is kp bit 2 is kj bit 1 is ky and bit is il Each filter coefficient and the integration limit can range in from hex 0000 to 7FFF positive only If ali coefficient values are ioaded then ten bytes of data including the filter contro word will follow the LFIL command Again the busy bit has to be checked between ihe command byte and filter control word and between data byte pairs Use of new
55. annel one or R4 channel two 5 Potentiometers R1 and R3 adjust the full scale output voltage to 10 volts These potentiometers are set at the factory and should not be adjusted Calibration 17 This page intentionally left blank Calibration 18 APPENDIX TECHNICAL DATA 5328 SPECIFICATIONS Output voltage 10V Output current 29 mA Power Specifications typical 12V 15 mA 15 mA 12V 5mA 5mA Environmental specifications 20 to 85 C operating RH 5 to 95 noncondensing Technical Data 19 JUMPER CONFIGURATIONS Interrupt Lines W1 amp W2 Pins J umpered Interrupt Request Line 11 12 1802 9 10 7 8 1804 5 6 5 3 4 IRQ6 1 2 IRQ7 9 11 Nointerrupt line selected NOTE ThelRQ number is marked next to each jumper posiiton on the card Base Address Select W3 Pins J umpered Base Address 1 2 3 4 5 6 100H 3 4 5 6 110H 1 2 5 6 120H 5 6 130H 2134 140H 3 4 150H 1 2 160H Not jumpered 170H default Technical Data 20 CONNECTOR PINOUTS 5328 DAC Output amp J2 Function NC NC 7 Encoder Ch A 8 Encoder Ch A 9 Encoder Ch B 10 Encoder Ch B 11 Encoder Index 12 Encoder Index 13 DAC Out 14 DAC Gnd Technical Data 21 5329 PWM Output amp J2 5V 5V Gnd
56. arranties of merchantability and fitness for a particular purpose which Octagon specifically disclaims Octagon neither assumes nor authorizes any other liability in connection with the sale installa tion or use of its products Octagon shall have no liability for incidental or consequential damages of any kind arising out of the sale delay in delivery installation or use of its products SERVICE POLICY 1 Octagon s goal is to ship your product within 5 working days of receipt 2 Ifa product should fail during the warranty period it will be repaired free of charge For out of warranty repairs the customer will be invoiced for repair charges at current stan dard labor and materials rates 3 Customers that return products for repairs within the warranty period and the product is found to be free of defect may be liable for the minimum current repair charge RETURNING A PRODUCT FOR REPAIR Upon determining that repair services are required the customer must 1 Obtain an RMA Return Material Authorization number from the Customer Service Department 303 430 1500 2 If the request is for an out of warranty repair a purchase order number or other acceptable information must be sup plied by the customer 3 Indudea list of problems encountered along with your name address telephone and RMA number 4 Carefully package the product in an antistatic bag Failure to package in antistatic material will VOID all warranties
57. asked unmasked status of each interrupt See Table Any zeros in this 6 bit field mask disable the corresponding interrupts while any ones unmask enable the corresponding interrupts In the case of the examiple program the second byte of the MSKI data word 40 hex enables the breakpoint interrupt All other interrupts are disabled masked When interrupted the host processor can read the Status Byte to determine which interrupt condition s occurred See Table Note Command 5 controls only the host interrupt process Bits one through six of the Status Byte reflect actual conditions independent of the masked unmasked status of individual interrupts This feature al lows interrupts to be serviced with a polling scheme Set Breakpoints Absolute and Relative An SBPA command sequence enables the user to set breakpoints in terms of absolute shaft position An SBPR command sequence enables setting breakpoints relative to the current target position When a breakpoint position is reached bit six of the status byte the breakpoint interrupt flag is set to logic high If this interrupt is enabled un masked the host will be interrupted via the host interrupt output pin 17 An SBPA or SBPR command initiates loading setting breakpoint The two data words written immediately follow ing the SBPA or SBPR command represent the break point position The example program contains a relative breakpoint set at 80 000 c
58. ause positive motor torque The LM628 when configured for 12 bit output pro vides signals which control the demultiplexing process See Figure 8 tor details TL H 9219 13 Note Sign output pin 18 not shown FIGURE 11 PWM Output Signal Format TABLE LM828 User Command Set Command Descripilon Note RESET initialize Reset LM628 9 1 PORTS Initialize Select 8 Bit Output 9 2 12 Initialize Select 12 Bit Output 0 2 Initialize Define Home 9 1 SIP interrupt Set Index Position 0 1 LPEI Interrupt Interrupt on Error 2 1 Interrupt Stop on Error 2 1 SBPA Interrupt Set Breakpoint Absolute 4 1 SBPR interrupt Set Breakpoint Relative 4 1 MSK Interrupt Mask Interrupts 2 4 RSTI Interrupt Reset Interrupts 2 1 LFiL Filter Load Filter Parameters 24010 1 UDF Filter Update Filter 0 1 Trajectory Load Trajectory 21014 4 STT Trajectory Start Motion 9 3 RDSTAT Report Read Status Byte 1 14 RDSIGS Report Read Signals Register 2 1 RDIP Report Read index Position 4 1 RDDP Read Desired Position 4 1 RDRP Read Real Position 4 1 RODV Read Desired Velocity 4 1 RDRV Read Real Velocity 2 1 RDSUM Read integration Sum 2 1 Note 1 Commands may be executed On the Fly during motion Note 2 Commands not applicable to execution during motion Note 3 Command may bs execuled during motion if acceleration parameter was not changed Note 4 Command needs code because the command port status byte read is totally su
59. bit positive only integers having 16 bit fractions The in teger portion of velocity specifies how many counts per sampiing interval the motor will traverse The fractional por tion designates an additional fractional count per sampling interval Although the position resolution of the LM62 is limited to integer counts the fractional counts provide in creased average velocity resolution Acceleration is treated in the same manner Each sampling interval the command ed acceleration value is added to the current desired veloci ty 10 generate a new desired velocity unless the command velocity has been reached One determines the trajectory parameters for a desired move as follows If for example one has a 500 line shaft encoder desires that the motor accelerate at one revolution per second per second until it is moving at 600 rpm and then decelerate to a stop at a position exactly 100 revolu tions from the start one would calculate the trajectory pa rameters as follows Theory of Operation continue let target position units encoder counts let encoder lines 4 system resolution then 500 4 2000 and P 2000 desired number of revolutions P 2000 100 revs 200 000 counts value to load P coding 00030D40 hex code written to LM628 V velocity units counts sample T sample time seconds 341 us with 6 MHz dock iet conversion factor 1 minute 60 seconds then R T
60. bit 31 is reset to zero Further counts in the negative direction cause the position register to count down to zero as would be expected With management there is no reason why absolute position should be lost even when changing between velocity and position modes 6 6 More on Use of Commands 6 6 1 If filter parameter and trajectory commands pipelined for synchronization of axes can the Update Filter UDF and Start STT commands be issued con secutively Answer Yes 6 6 2 Can commands be issued between another com mand and its data Answer No 6 8 3 What is the response time of the set breakpoint commands SBPA and SBPR Answer There is an uncertainty of one sample interval in the setting of the breakpoint bit 6 in the Status Byte in re sponse to these commands 6 6 4 What happens when the Set index Position SIP command is issued Answer On the next occurrence of three inputs from the position encoder being low the corresponding position is loaded into the index register This can be read with the Read Index Position command RDIP Bit 0 of the Read Sig nals register shows when SIP command has been is sued but the index position has not yet been acquired RDSIGS command accesses the Read Signals Register 6 6 5 What happens if the motor is not able to keep up with the specified trajectory acceleration and velocity values Answer large saturated position error will ba generated and the contr
61. ble to read A31 on the backplane with the words OCTAGON SYSTEMS CORP running vertically along the left side of the backplane This position is feet down for a table mount cage and feet back for a rear mount 3 Slide the card into the card cage The components on the card should face to the left The lettering on the card Octagon Systems Corp should be on the top edge of the card and the gold contact fingers toward the backplane 4 Power on the system 5 Theamber LED will light briefly whenever the card is ac cessed This is useful when troubleshooting 6 You are now ready to program and use the motion control card TROUBLESHOOTING In you have difficulty getting your system to work properly remove all cards except the control card and the Motion Control Card from your system and check the power module and jumper configura tions Power Module The power module voltage should be 5V 0 25V when measured at the connector pins The power module ripple should be less than 50 mV Installation 12 J umper Configuration The Motion Control Card is shipped with jumper connections in place for Base 1 0 Address 100H and no interrupt lines selected J umper changes are usually not needed to get the system running If you changed the jumpers the system is not working prop erly return the system to the original jumper positions If you still encounter difficulties please contact the Technical Support
62. busy bit is set the 1 M628 will ignore any commands or attempts to transfer data A busy bit check module that polls the Status Byte and waits until the busy bit is reset will ensure successful host LM628 communications ft must be inserted after a command write or a read or write of the second byte of a data word Flow diagram 1 represents such a busy bit check module This module will be used throughout subse quent modules and programs Reading the Status Byte is accomplished by executing RDSTAT command RDSTAT is directly supported by LM628 hardware and is executed by pulling CS PS and RD logic low Flow Diagram 1 Busy bit Check Module START Read the Status Byte Busy Bit set TL H 10860 3 INITIALIZATION MODULE general an initialization module contains reset com mand and other initialization interrupt control and data re porting commands The example initialization module detailed in Figure 3 con tains a hardware reset block and a PORT 12 command Hardware Reset Block immediately following power up a hardware reset must be executed Hardware reset is initiated by strobing RST pin 27 logic low for a minimum of eight LM628 clock peri ods The reset routine begins after RST is returned to logic high During the reset execution time 1 5 ms maximum the LM628 will ignore any commands or attempts to transfer data hardware reset forces the LM628 into the state described in what
63. ccel eration while the motor is moving in mid trajectory the motor off command has to be issued by setting command bit B Than the new acceleration can be loaded again using the LTRJ command When the start command STT is issued the motor will be energized and the trajectory generator will Start generating a new profile from the actual position when the STT command was issued doing this the trajectory generator will assume that the motor starts from a stationary position in the normal way It the motor has sufficient inertia and is still moving when the STT command is issued then the control loop will atiempt to bring the motor on to the new profile possibly with a largo error value being input to the PID filter and a consequential saturated output until the motor velocity matches the profile This is a classic case of overload in a feedback system It will operate in an open loop manner until the error input gets within controllable bounds and then the feedback loop will close Performance in this situation is unpredictable and application specific LM628 629 was not intentionally designed to operate in this way 5 1 2 PID Fitter Bode Plots GAIN dB Ki Kp PHASE DEGREES 4 6 2 Command Update Rate If an LM628 629 is updated too frequently by the host it will not keep up with the commands given The LM628 629 aborts the current trajectory calculation when it receives new STT command resulting in
64. ch up with the cur tent desired position 2 9 Motor Output Port LM628 output port is contigured to 8 bits after reset The 8 bit output is updated once per sample interval and heid until it is updated during the next sample interval This al lows use of a DAC without a latch For 12 bit operation the PORT12 command should be issued immediately after re sat The output is multiplexed in two 6 bil words using pins 18 through 23 Pin 24 is low for the least significant word and high for the most significant The rising edge of the active low strobe pin 25 shauld be used to strabe the output into an external latch see Figure 7 The DAC output is offset binary code the zero codes are hex 80 for 8 bits and hex 800 for 12 bits DATA PWS 8 25 em 24 STROME 23 zo Deine TL H t1018 7 FIGURE 7 LM628 12 Bit DAC Output Muttiplexed Timing The choice of output resolution is dependant an the user s application There is fundamental trade off between sam pling rate and DAC output resolution the M628 8 04 output at a 256 ps sampling interval will most often provide as good results as slower e g microcontroller implementa tion which has a 4 ms typical sampling interval and uses a 12 bit output The LM628 gives the choice of a 12 bit DAC output at a 256 sampling interval for high precision applications LM629 PWM sign and magnitude signals are output from pins 18 and 19 respectively Th
65. com mand sequence the number of data words following the filter control word can vary in the range from zero to four in the case of the example module the first byte of the filter contro word 00 hex programs a derivative sampling coeffi cient of one The second byte x8 hex indicates only the proportional gain coefficient will be loaded Immediately following the filter control word the proportion al gain coefficent is written in this example ts set to ten with the data word 000A hex The other three filter coeffi cients remain at zero their reset value Update Filter The update filter command UDF transfers new filter coeffi cients from input buffers to working registers Until UDF is executed the new filter coefficients do not affect the trans fer characteristic of the filter 8 or 12 bit from quadrature encoder TL H 10860 9 FIGURE 5 LM628 Simplified Block Diagram Form TABLE Filter Control Word Bit Allocation high byte ps e o o fro Derivative term Sampling interval selection code not used logical 1 corresponding coefficient will be loaded logical 0 corresponding coefficient will not be loaded TL H 10860 10 TABLE IV Derivative Term Sampling Interval Setection Codes Filter Control Word Bit Position Selected Derivative Term ds 15 14 2 10 9 Sampling Intervai Ta 0 0 0 0 9 0 9 1 Ts 0 0 0 0 0 0 1 2 2T
66. crocode was designed this way to achieve minimum latency when communicating with the host However if this communication becomes too frequent and on going calcula tions are interrupted too often corruption will occur In 256 sample interval the filter calculation takes 50 us outputting a sample 10 and trajectory calculation 90 us the LM626 behaves in a manner that is unexpected the host communication rate should be checked in relation to these timings 2 12 Filter initial Values and Tuning When connecting up a system for the first time there may be possibility that the loop phasing is incorrect As this may cause violent oscillation it is advisable to initially use a very low value of proportional gain say 1 with ka k ali set to zero which will provide a weak level drive to the motor The Start command STT is sent to LM628 629 to close the control loop and energize the motor If the system does oscillate with this low value of K than the motor con nections should be reversed Having determined that the loop phasing is correct kp can be increased to a of about 20 to see that the contral system basically works This value of should hold the motor shaft reasonably stiffly returning the motor to the set position which will be zero until trajectory values have been input and a position move performed oscillation or unac ceptable ringing occurs with a ky value of 20 reduce this
67. ction 5 Theory is a short foray into theory which relates the PID coefficients that would be calculated from a continu ous domain control toop analysis to those of the discrete domain including the scaling factors inherent to the LM628 629 No attempt is made to discuss control system theory as such readers should consult the ample refer ences available some suggestions are made at the end of this application note Section 5 concludes with an example trajectory calculation reviving those perhaps forgotten ideas about acceleration velocity distance and time Section 6 Questions and Answers is in question and an swer format and is born out of and dedicated to the many interesting discussions with customers that have taken place 1 2 Brief Description of LM628 629 LM628 623 is a microcontroller peripheral that incorporates in one device all the functions of a sample data motion con trol system controller Using the LM628 629 makes the po tentially complex task of designing a fast and precise motion control system much easier Additional features such as trajectary profile generation on the fly update of loop compensation and trajectory and status reporting are in cluded Both position and velocity motion control systems can be implemented with the LM628 629 MOTOR ORIVE OPTIONS FOR 10628 or 10629 0200 or 031208 1418233 118298 1000200 OPTICAL POSTION ENCODER TL H 11018 1 FIGURE 1 LM628 and LM62
68. d A further check car be used to make certain that a reset has bean success ful by using the Reset Interrupts command RSTI Before sending the ASTI issue the Mask Interrupts command MSKI and mask data that disables all interrupts this mask is sent as two bytes of data equaling hex 0000 Then issue the RSTI command plus mask data that resets all interrupts this equals hex 0000 and is again sent as two bytes Do not forget to check the busy bit between the command byte and data byte pairs When the chip has reset properly the status byte will change from hex 84 or CA to hex 80 or CO 4 4 2 initializing 134628 Output Port Reset sets the LM628 output port size to 8 bits if a 12 bit DAC is being used then tha output port size is set by the use of the 12 command 4 4 3 interrupt Commands Optionally the commands which cause the LM628 629 to take action on a predefined condition e g SIP LPEI LPES SBPA and SBPR can be included in the initialization these are discussed under Interrupt Commands 4 5 Performance Refinemenis 4 5 1 Derivative Sample Rate The derivative sample interval is controllable to improve the stability of velocity high inertia loads At low speeds when fractional counts for velocity are used the integer po sition counts desired and actual only change after several sample intervals of the 1 628 629 20480 This means that for sample intervals between integer count changes the
69. d shaft position tracks actual shaft position Under these con ditions the motor drive signal is zero The control system can not affect shaft position The shaft should be stationary and free wheeling If there is significant drive amplifier offset the shaft may rotate slowly but with minimal torque capability Note Regardless of the free wheeling state of the shaft the LM628 continu ously tracks shaft absolute position FILTER PROGRAMMING MODULE The example filter programming modute is shown in Figure 6 Load Filter Parameters Coefficients An LFIL Load Filter command sequence includes com mand LFIL a filter control word and a variable number of data words The LFIL command initiates loading filter coefficients into input buffers The two data bytes written immediately after LFIL com prise the filter control word The first byte programs the de rivative sampling coefficient ds i e selects the derivative sampling interval The second byte indicates with logical ones in respective bit positions which of the remaining four filter coefficients will be loaded See Tables HI and IV Any combination of the four coefficients be loaded within a single LFIL command sequence Immediately following the filter control word the filter coeffi cients are written Each coefficient is written a pair of data bytes a data word Because any combination of the four coefficients can be loaded within a single
70. d Position Error for Stopping Command Code 1A Hex Data Bytes Two Data Range 0000 to 7FFF Hex Executable During Motion Yes Instruction LPES is essentially the same as command LPEI above but adds the feature of turning off the motor upon detecting excessive position error The motor drive is not actually switched off it is set to half scale the offset binary code for zero As with command LPEI bit 5 of the status byte is also set to logic high The first byte of threshold data written with command LPES is the more significant The user have the LM628 interrupt the host to signify that an excessive position error has occurred See the descriptions for commands MSKi and RSTI 58 COMMAND Command Code 20 Hex Data Bytes Four Data Range C0000000 to SFFFFFFF Hex Executable During Motion Yes This command enables the user to set a breakpoint in terms of absolute position Bit 6 of the status byte is set to logic high when the breakpoint position is reached This condition is useful for signaling trajectory and or filter parameter up dates The user can also arrange to have the LM628 inter fupt the host to signify that breakpoint position has been reached See the descriptions for commands MSKI and ASTI SBPR COMMAND Command Code 21 Hex Data Bytes Four Data Range See Text Executable During Motion Yes This command enables the user to set a breakpoint in terms of relative position As with command SBPA b
71. ded After you manually turn the motor a few degrees in either direction and then release it the motor should spring back to its original position The motor shaft should become increasingly difficult to turn the farther you turn it away from its original position There are several ways to fix a loop inversion Sometimes the easiest way is to simply swap the motor power leads from the amplifier You can also swap the A and B encoder inputs After fixing a suspected loop inversion retry all of the above tests Loop Phasing 16 4 CALIBRATION The 5328 board is calibrated at the factory and should not require further adjustment n some cases however it may be necessary to null the amplifier zero offset If so use the following procedure WARNING When you adjust the zero offset the motor may turn slightly Keep clear of the motor shaft and any attached loads until you have completed the calibration process 1 Turn on and boot the Micro PC system with the 5328 board 2 Turn on the motor amplifier 3 Attach a digital voltmeter Fluke 77 or equivalent 3 5 digit to the DC out and DC ground pins on connector J 1 or J 2 of the 5328 board 4 Adjust the potentiometer R2 for channel one or R4 for channel two until you obtain a reading of 0 volts The motor should be stationary If the motor rotates with a reading of O volts on 10r 2 a motor amplifier offset exists t may be nulled by adjusting R2 ch
72. ded via the LFIL command do not affect the filter transfer characteristic Busy bit Check Module This command initiates loading the trajectory parameters input buffers Busy bit Check Module d 00 These two bytes are the d 00 LB trajectory control word A 00 hex LB indicates no trajectory parameters will be loaded Busy bit Check Module c 01 STT STT must be issued to execute the desired trajectory FIGURE 22 Initialization Section Filter Tuning Program Continued 3 Determine the Proportional Gain Coefficient Inertial loading causes following or tracking error position error associated with a moving shaft External disturbances and torque toading cause displacement error position error associated with a stationary shaft The filter proportional term provides a restoring force to minimize these position errors The restoring force is proportional to the position error and increases linearly as the position error increases See Figure 21 The proportional gain coefficient is the constant of proportionality Coefficient kp is determined with an iterative process the value of kp is increased and the system damping is evaluat ed This is repeated until the system is critically damped System damping is evaluated manually Manually turning the shaft reveals each increase of kp increases the shaft stiffness The shaft teels spring loaded and if forced away from its desired holding position a
73. der you want to use with the card For two channel systems connect 2 to the equipment it will control You can also use STB 14 to connect J 1 and J 2 to the amplifier and encoder Refer to Appendix A for J 1 and J 2 connector pinouts The motor command output for the 5328 is a 10V analog signal capable of driving a load of 500 ohms or larger 20 mA or less The encoder inputs for either card accept a differential comple mentary TTL level square 2 or 3 channel encoder J 1 and J 2 each provide 5V for powering the encoder If you are using an encoder with open collector outputs you must attach pull up resistors connected from J 1 or 2 to 45V Installing The Card Into The Card Cage WARNING Take care to correctly position the card in the card cage The and ground signals must match those on the backplane Figure 2 4 shows the relative position of the card as it is installed in the card cage Card Edge Pins 1 8 B31 5328 Motion Control Card Card Edge Pins 1 amp 1 Micro PC Motherboard Al Figure 2 4 Card Edge Orientation Installation 11 Toinstall either the 5328 in the card cage 1 Turn card cage power off 2 Position the cage so that the backplane is away from you the power module is to the right and the open side of the cage is closest to you The lettering on the backplane should be right side up for example you should be a
74. dual full bridge driver inter faced to the LM629 PWM outputs to provide a switch mode power amplifier for driving small brush commutator motors Figure 17 shows an LM621 brushless motor commutator interfaced to the LM629 PWM outputs and a discrete device switch mode power amplifier for driving brushless DC mo tors Incremeniai Encoder Interface The incremental position feedback encoder interface con sists of three lines Phase A Pin 2 Phase B Pin 3 and Index Pin 1 The index pulse output is not available on some encoders The LM628 will work with both encoder types but commands and RDIP will not be meaningful without an index pulse or alternative input for this input be sure to tie Pin 1 high if not used Some consideration is merited relative to use in high Gauss ian noise environments If noise is added to the encoder inputs either or both inputs and is such that it is not sus tained until the next encoder transition the LM628 decoder logic will reject it Noise that mimics quadrature counts or persists through encoder transitions must be eliminated by appropriate EMI design Simple digital filtering schemes merely reduce susceptibil ity to noise there will aways be noise pulses longer than the filter can eliminate Further any noise filtering scheme reduces decoder bandwidth In the LM628 it was decided since simple filtering does not eliminate the noise problem to not include a noise filter in favor
75. e LTRJ command sequence the number of data words fol lowing the trajectory control word can vary in the range from zero to six in the case of the example module the first byte of the trajectory control word 00 hex programs the LM626 to op erate in position mode The second byte hex indicates velocity and position will be loaded and both parameters are absolute Four data words two for each parameter loaded follow the trajectory control word Start Motion Control The start motion control command STT STarT transfers new trajectory parameters from input buffers to working reg isters and begins execution of the new trajectory Until STT is executed the new trajectory parameters do not affect shaft motion Note At this point no actual trajectory parameters are loaded Calculation of trajectory parameters and execution of example moves is left for a later section Table V Trajectory Control Word Bit Allocation high byte not mot net forward Stop used used used Direction Abruptly Velocity Mode only veloci locity Mode stop Turn off Smoothly Motor TL H 10860 11 low byte not not Acceleration Velocity Position used used data is will ba will be relative loaded loaded Acceleration Velocity Position will be loaded date is data relative relative TL H 10860 12 Port Bytes Command Comments 1F LTRJ This command initiates loading the trajectory parameters inpu
76. e sign output is used to con trol motor direction Tha PWM magnitude output has reso lution of 8 bits from maximum negative drive to maximum positive drive The magnitude output has an off condition with the output at logic low which is useful for turning a motor off when using a bridge motor drive circuit The mini mum duty cycle is 1 128 increasing to a maximum of 127 128 in the positive direction and a maximum of 128 128 in the negative direcition i e a continuous output There are tour PWM periods 1 629 sample interval With an 8 MHz clock this increases the PWM output rate to 15 6 kHz from the LM629 maximum 3 8 kHz sample rate see Figure 8 for turther timing information CYCLE WAGHITUDE WAVEFORMS pin 19 5 2 IE m de Pad sex e POS di 1 t 4 176 11018 8 Hote Sign output pin 18 not shown FIGURE 6 LM629 PWM Output Signal Format 2 10 Host Interface LM628 629 has three internal registers status high and low bytes Figure 9 which are used to communicate with the host microcontroller These are controlled by the WR and PS lines and by use of the busy bit of the status byte The status byte is read by bringing RD and PS low bit 0 is the busy bit Commands are written by bringing WA and PS low When PS is high WA brought tow wri
77. e trajectory control word 00 hex pro grams position mode operation The second byte 2B hex indicates all three trajectory parameters will be loaded 1t also indicates both acceleration and velocity will be abso lute values while position will be a relative value Trajectory Parameters Calculations Independent of the current resting position of the shaft the shaft will complete thirty revolutions in the reverse direction Total time to complete the move is fifteen seconds Total time for acceleration and deceleration is five seconds The reference system utilizes a one thousand line encoder The number of counts for each complete shaft revolution and the total counts for this position move are determined 1000 CYCLES S883 COUNTS REVOLUTION CYCLE REVOLUTION 4 COUNTS REVOLUTION With respect to time two thirds of the move is made at max imum velocity and one third is made at a velocity equal to one half the maximum velocity Therefore total counts traveled during acceleration and deceleration periods is one fifth the total counts traveled See Figure 75 X 30 REVOLUTIONS 120 000 COUNTS 120 000 COUNTS _ total counts traveled during 5 24 000 COUNTS acceleration and deceleration 24 000 COUNTS _ counts traveled during 12 000 COUNTS Socoleration The reference system uses an 8 MHz clock The sample period of the reference system is determined 1 SECONDS 8x108Hz SAMPLE The number of samples during acceleration a
78. ection negative TUH 11018 3 FIGURE 3 Quadrature Encoder Output Signals and Direction Decode Table FROM OPTICAL ENCODER M2 INDEX MAIN PROCESSOR BUS 16 BITS RELATIVE POSITION COUNTER TL H 11016 4 FIGURE 4 LM628 629 Motor Position Decoder MEN The 16 bit up down counter is used to capture the differ ence in position from one sample to the next A position faich attached the up down counter is strobed at the same time in every sample period by a sync pulse that is generated in hardware The position latch is read soon after the sync pulse and is added to the 32 bit position register in RAM that holds the actual current position This is the valus that is subtracted in the summing junction every sample in terval from the new desired position calculated by the tra jectory generator to form the error input to the filter Maximum encoder state capture rate is determined by the minimum number of clock cycles it takes to decode each encoder state see Figure 3 this minimum number is 8 clock Cycles capture of the index pulse is also achieved during thase 8 clock cycles This gives a mors than adequate 1 MHz maximum encoder state capture rate with the 8 MHz devices 750 kHz for the 6 MHz devices For example with the 1 MHz capture rate motor using 500 line encoder will be moving at 30 000 rpm There is some limited signal conditioning at the decoder input to rernove problems t
79. efficient ds Tuning the filter equates to determining values for these variable coefficients values that critically damp the control system Filter coefficients are best determined with a two step ex perimental approach the first step the values of kp and kg along with 4 and 4 are systematically varied until reasonably good response characteristics are obtained Manual and visual methods are used to evaluate the effect of each coefficient on system behavior In the second step an oscilloscope trace of the system step response provides detailed information on system damping and the filter coef ficients determined in step one are modified to critically damp the system Note in step one adjustments to filter coefficient values are inherently coarse while in step two adjustments are inherently fine Due to this coarse fine nature steps one and two complement each other and the two step approach is presented as the best tuning method The PAD filter can be tuned with either step one step two alone STEP ONE MANUAL VISUAL METHOD introduction in the first step the values of kp and along with ij and dg are systematically varied until reasonably good response characteristics are obtained Manual and visual methods are used to evaluate the effect of each coefficient on system behavior Note The next four numbered sections are ordered steps ta tuning filter 1 Prepare the System The
80. el ative stability of the system 2 The rise time t is the time required for the response to rise from ten to ninety percent of the final value 3 The settling time ts is the time required for the response to reach and stay within two percent of the final value A critically damped control system provides optimum per formance The step response of a critically damped control system exhibits the minimum possibie rise time that main tains zero overshoot and zero ringing damped oscillations Figure 20 illustrates the step response of a critically damped control system Allowable tolerance m TL H 10860 17 FIGURE 19 Unit Step Response Curve Showing Transient Response Attributes 9 TL H 10860 18 FIGURE 20 Unit Step Response of a Critically Damped System INTRODUCTION The LM628 is a digital PID controller The loop compensa tion filter of a PID controller is usually tuned experimentally especially if the system dynamics are not well known or defined The ultimate goal of tuning the PID filter is 10 critically damp the motor contro system provide optimum tracking and settling tirne As shown in Figure 5 the response of the PID filter is the sum of three terms a proportional term an integral term and a differential term Five variables shape this response These five variables include the three gain coefficients and the integration limit coefficient i and the deriv ative sampling co
81. eleration rate At any time during the move the maximum velocity and or the target position may be changed and the motor will accelerate or decelerate accordingly Figure 7Cillustrates two typical trap ezoidal velocity profiles Figure 10 shows a simple trape 204 while Figure 10 b is an example of what the trajectory looks like when velocity and position are changed at differ ent times during the move When operating in the velocity mode the motor accelerates to the specified velocity at the specified acceleration rate and maintains the specified velocity until commanded to stop The velocity is maintained by advancing the desired position at constant rate If there are disturbances to the motion during velocity mode operation the long time aver age velocity remains constant If the motor is unable to rnaintain the specified velocity which could be caused by a locked rotor for example the desired position will continue to be increased resulting in a very large position error If this 61988 Natione Semiconductor Corpoation condition goes undetected and the impeding force on the motor is subsequently released the motor could reach a very high velocity in order to catch up to the desired position which is still advancing as specified This condition is easi ly detected see commands LPEI and LPES trajectory parameters are 32 bit values Position 15 a signed quantity Acceleration and velocity are specified as 16
82. elocity Scaled 13 422 200876 Velocity Rounded V 00 00 34 6E 20 878 000 rex 2 0 REVOLUTIONS 8000 COUNTS FIGURE 12 Calculations of Trajectory Parameters for Simple Absolute Position Move Port Bytes Command Comments Initialization Module Filter Programming Module LTRJ This command initiates loading the trajectory parameters input buffers Busy bit Check Module d 00 HB These two bytes are the d 2A LB trajectory control word A 2A hex LB indicates acceleration velocity and position will be loaded and ail three parameters are absolute Busy bit Check Module d 00 HB Acceleration is loaded in two d 00 LB data words These two bytes are the high data word in this case the acceleration is 0 1 2 Busy bit Check Module d 00 acceleration data word low d 02 Busy bit Module d 00 HB velocity is loaded in two data d 00 tB words These two bytes are the high data word this case the velocity is 0 2 rev sec Busy bit Check Module d 34 HB velocity data word low d 6E LB Busy bit Check Module d 00 HB Position is loaded in two data d 00 LB words These two bytes are the high data word this case the position loaded is eight thousand counts This in a move of two revolutions in the forward direction Busy bit Check Module d HB position data word low d 40 LB Busy bit Check Module c 0
83. eneration Section of Filter Tuning Program 17 Port Sytes Command ag 90 04 90 97 At 20 90 90 Comments LTRS This command initiates loading the trajectory parameters input buffers Busy bit Check Module HB These two bytes are the LB trajectory control word 28 hex LB indicates acceleration velocity and position will be loaded and both acceleration and velocity are absolute while position is relative Busy bit Check Module HB Acceleration is loaded in two LB data words These two bytes are the high data word Busy bit Check Module acceleration data word low Busy bit Check Module HB Velocity is loaded in two data LB words These two bytes are the high data word Busy bit Check Modula HB velocity data word low 18 Busy bit Check Module HB Position is loaded in two data iB words These two bytes are the high data word Busy bit Check Module HB position data word low LB Port Bytes Command Comments 01 Busy bit Check Module sit STT must be issued to execute the desired trajectory Busy bit Check Modula RDSTAT This command reads the Status Byte ftis directly supported by LM628 hardware and can be executed at any time by pulling CS PS and logic law Status intormation remains valid as long as FID is logic low If the Trajectory Complete interrupt bit is set continue Otherwise loop back to R
84. equence The second ap proach is to avoid hardwired interrupts and poll the LM628 Status byte for interrupt status The status byte always reflects the interrupt condition status independent of whether or not the interrupts have been masked Typical Host Computer Processor interface The LM628 is interfaced with the host oomputer processor via an 8 bit parallel bus Figure 12 shows such an interlace and a minimum system configuration shown in Figure 12 the LM628 interfaces with the host data address and control lines The address lines are de coded to generate the LM628 CS input the host address LSB directly drives the LM628 PS input Figure 12 also shows an 8 bit DAC and en LM12 Power Op Amp interfaced to the LM628 LM628 and High Performance Controller HPC Interface Figure 13 shows the LM628 interfaced to a National HPC High Performance Controller The delay and logic associat ed with the WR line is used to effectively increase the write data hold time of the HPC as seen at the LM628 by caus ing the WA puise to rise early Note that the HPC CK2 out put provides the clock for the LM628 The 741 5245 is used to decrease the read data hold time which is necessary when interfacing to fast host busses Interfacing 12 DAC Figure 14 illustrates use of a 12 bit DAC with the LM628 The 7413378 hex gated D flip flop and an inverter demulti plex the 12 bit output DAC offset must be adjusted to mini mize DAC l
85. error voltage wil not change for successive samples As the derivative term multiplies the difference betweeen the previous and current error values if the deriv ative sample interval is the same as the sample interval severa conseculive sample intervals will have zero deriva tive term and hence no damping contribution Lengthening the derivative sample interval ensures a more constant de rivate term and hence improved stability Derivative sample 17 interval is loaded with the filter coefficiont values the most significant byte of the LFIL control word everytime the command is used the host therefore needs to store the curent value for reloading at times of filter coefficient change 4 5 2 Integral Windup Along with the integra filter coefficient k an integration limit il has to be input into LM628 629 which allows the usar to set the maximum value of the integration term of equation 3 Section 5 2 2 This term is then able to accu mutate up to the value of the integration limil and any further increase due to error of the same sign is ignored Setting the integration limit enables the user to prevent an effect called integral Windup For example if an 1 528 629 atternpts to accelerate a motor at a faster rate than it can achieve a very large integral term will result When the 628 629 tries to stop the motor at the target position the large accumulated integral term will dominate the filter and cause the moto
86. es Filter Control Word See Text Filter Coefficients 0000 to 7FFF Hex Pos Only Integration Limit 0000 to 7FFF Hex Pos Only Executable During Motion Yes The filter parameters coefficients which Bre written to the LM628 to contro loop compensation are kp ki kd and il integration limit The integration limit il constrains the contribution of the integration term 55 see 1 to values equal to less than a user defined maximum value this capability minimizes integral or reset wind up an overshooting effect of the integral action The positive only input value is compared to the absolute 1089 Nationa Semiconductor Corpomtion 12 Filter Control Commands continued magnitude of the integration term when the magnitude of The data bytes specified by and immediately following the integration term value exceeds the il value with appropri filter control word are written in pairs to comprise 16 bit ate sign is substituted for the integration term value words The order of sending the data words to the LM628 The derivative term sampling interval is also programmable corresponds to the descending order shown in the above via this command After writing the command code the first description of the filter control word i e beginning with kp two data bytes that are written specify the derivative term then ki kd and il Tho first byte of each word is the more sig sampling interval and w
87. es It also contains an LTRJ command sequence and an STT command Note Execution of this simple program is only required the first time naw system is used Load Trajectory Parameters An LTRJ Load TRaJectory command sequence includes command LTRJ a trajectory control word and a variable number of data words in the case of the Loop Phasing Program the first byte of the trajectory control word 00 hex programs the LM628 to operate in position mode The second byte 00 hex indi cates no trajectory parameters will be loaded ie in this program zero data words follow the trajectory control word The three trajectory parameters will remain at zero their reset value Start Motion Control The start motion control command STT STarT transfers new trajectory parameters from input buffers to working reg isters and begins execution of the new trajectory Until STT is executed the new trajectory parameters do not affect shaft motion Port Bytes Command Comments Initialization Module Filter Programming Module This command initiates loading the trajectory parameters input buffers Busy bit Check Module d 00 HE These two bytes are the d 00 LB trajectory control word A 00 hex LB indicates no trajectory parameters will be loaded Busy bit Check Module 01 8 STT must be issued to execute the desired trajectory FIGURE 9 Loop Phasing Program Comments Execution of command STT results in e
88. ext The maximum time to complete RESET tasks is 1 5 ms The RESET defautt size of ihe DAC port is eight bits This command initializes the DAC port for a 12 bit DAC It should not be issued in systems with 8 bit DAC This command resets only the interrupts indicated by in bits one through six of the next data word It also resets bit fifteen of the Signals Register and the host interrupt pin pin 17 don t care Zeros in bits one through six indicate interrupts will be reset This command masks the interrupts indicated by zeros in bits one through six of the next data word don t 04 hex LB enables unmasks the trajectory complete interrupt All other interrupts are disabled masked See Table This command initiates loading the filter coefficients input buffers These two bytes are the fitter control word A 00 hex sets the derivative sampling interval to 2048 by setting ds to one A x2 hex LB indicates only kg will be loaded The other filter parameters will remain at zero their reset default value FIGURE 22 initialization Section Filter Tuning Program Continued on Next Page 16 Port Bytes Command Comments d 00 These two bytes set ky to d 02 LB two Busy bit Check Module 04 UDF This command transfers new filter coefficients from input buffers to working registers Until UDF is executed coefficients loa
89. filter coeffi cient values by the LM628 629 is initiated by issuing the single byte Update Filter command UDF When controlled movement of the motor has been achieved by programming the filter and trajectory attention turns to incorporating the LM628 629 into a system Inter rupt Control Commands and Data Reporting Commands en able the host microcontroiler to keep track of LM628 629 activity 3 5 Interrupt Control Commands There are five commands that can be used to interrupt the host microcontroller when a predefined condition occurs and two commands that control interrupt operation When the LM628 629 is programmed to interrupt its host the event which caused this interrupt can be determined from bits 1 to 6 of the Status Byte additionally bit 0 is the busy bit and bit 7 indicates that the motor is off the Interrupt Control commands are executable during motion The Mask Interrupts command is used to tell LM628 629 which of bits 1 to 6 will interrupt the host through use of interrupt mask data associated with the com The dala is in the form of a data byte pair bits 1 6 ol the least significant byte being set to logic 1 when an inter source is enabled The Reset Interrupts command resets interrupt bits in the Status Byte by sending data byte pair the least significant byte having logic 0 in bit positions 1 to 6 if thay are to be reset Executing the Set Index Position command
90. function bit 10 and that the host interrupt output Pin 17 has been set to logic 1 bit 15 Full details of the bit assignments of this command be found in the data sheet The Read Index Position RDIP command reads the posi tion recorded in the 32 bits of the index register in four data bytes This command with the SIP command can be used to acquire a home position or successive values These could be used for example for gross error checking Both on going 32 bit position inputs to the summing junction can be read Read desired position RDOP reads the cur rent desired position the demand or set point input from the trajectory generator and Read Real Position RDRP reads the current actual position of the motor LABEL MNEMONIC 3REMARK Initialization WAIT RDSTAT Read Desired Velocity RODV reads the current desired ve locity used to calculate the desired position profile by the trajectory generator It is a 32 bit value containing integer and fractional velocity information Read Real Velocity RDRV reads the instantaneous actual velocity and is 16 bit integer value Read Integration Term Summation Value RDSUM reads the accumulated value of the integration term This is a 16 bit value ranging from zero to the current il integration limit value 3 7 Software Example The following example shows the flow of microcontroller commands needed to get the LM628 629 to control sim ple motor move As it i
91. g 0 0 0 0 9 0 1 9 3 3Ts 0 0 0 0 0 0 1 1 4 1 1 1 1 1 1 1 256 2567 1 2048 x 23 System Sample Period Tq ds X Ts Derivative term Sampling interval Comments LFIL This command initiates loading the filter coefficients input buffers Busy bit Check Module d 00 HB These two bytes are the filter d 8 LB control word 00 hex HB sets the derivative sampling interval to 2048 by setting ds to one A x8 hex LB indicates only kp will be loaded The other filter parameters will remain at zero their reset default value Busy bit Check Module d 00 HB These two bytes set kp d 0 to ten Busy bit Check Module c 04 UDF This command transfers new filter coefficients from input buffers to working registers Until UDF is executed coefficients toaded via the LFIL command do not affect the filter transfer characteristic Busy bit Check Modute FIGURE 6 Filter Programming Module Comments After executing both the example initialization and example filter programming modules the following observations are made Filter gain is nonzero but desired shaft position con tinues to track actual shaft position Under these conditions the motor drive signal remains at zero The shaft should be stationary and free wheeling If there is significant drive offset the sh
92. gnal remains at zero and the control system can not affect shaft position the shaft should be stationary and free wheeling there is significant drive amplifier offset the shaft may rotate slowly but with minimal torque capability Unless new trajectory parameters are loaded execution of another STT command will restart the specified move Port Bytes Command Comments c LTRJ This command initiates loading the trajectory parameters input buffers Busy bit Check Module d HB These two bytes are the d 00 LB trajectory control word A x1 hex HB selects motor off as the desired stopping mode A 00 hex LB indicates no trajectory parameters will be loaded Busy bit Check Module 01 SIT The start motion control command STT must be executed to stop shaft motion Busy bit Check Module FIGURE 8 Stop Module Motor Off 11 PROGRAMS This section focuses on the development of four brief LM628 programs LOOP PHASING PROGRAM Following initial power up the correct polarity of the motor drive signal must be determined If the polarity is incorrect loop inversion the drive signal will push the shaft away from its desired position rather than towards it This results in motor runaway a condition characterized by the motor running continuously at high speed The loop phasing program detailed in Figure 9 contains both the example initialization and filter programming mod ul
93. hat would occur due to the asyn chronous position encader input being sampled on signal edges by the synchronous 1 628 529 But there is no noise filtering as such on the encoder lines so it is important that they kept clean and away from noise sources 2 3 Trajectory Protile Generator Desired position inputs to tha summing junction Figure 7 within the LM628 629 are provided by an internal indepen dent trajectory profile generator The trajectory profile gen erator takes information from the host and computes for each sampie interval a new current desired position The information required from the host is operating mode either position or velocity target acceleration target velocity and target position in position mode 2 4 Definitions Relating to Profile Generation The units of position and time used by the LM628 629 are counts 4 x encoder lines and samples sample intervals 2048 to_x respectively Velocity is therefore calculated in counts sample and acceleration in counts sample sam pie Definitions of target desired and actual within the profile generation activity as they apply to velocity accelera tion and position are as follows Final requested values are called target such as target position The values comput ed by the profile generator each sample interval on the way to the target value are called desired Real vaiues from the position encoder are called actual For example
94. he compensator is in the form of a three term PID filter proportional integral deriv ative this is implemented by a digital filter The coefficients for the PID digital filter are most easily determined by tuning the control system to give the required response from the load in terms of accuracy response time and overshoot Having characterized a ioad these coefficient vaiues are downloaded from the host before commencing move For a load that varies during movement more coefficionts can be downtoaded and used to update the PID filter at the mo ment the load changes Ail trajectory parameters except ac celeration can also be updated while a movement is in prog ress 2 0 DEVICE DESCRIPTION 2 1 Hardware Architecture Four major functional blocks make up the LM628 629 in addition to the host and output interfaces These are the Trajectory Profile Generator Loop Compensating PID Filter Summing Junction and Motor Position Decoder Figure 7 ALU CONTROL DATA BUS PARALLEL POSITION OUTPUT DECODER 2 IN FROM To DAC sey INCREMENTAL ENCODER TL H 11018 2 FIGURE 2 Hardware Architecture of LM628 629 Details of how LM628 629 implemented by purpose designed microcontroller are shown in Figure 2 The control algorithm is stored in a 1k x 16 bit ROM and uses 16 bit wide instructions A PLA decodes these instructions and provides data transfer timing signals for the single 16 bit data and inst
95. he status byte will be set to logic high The position is recorded when both encoder phase inputs and the index pulse input are logic iow This register can then be read by the user see description for command to facilitate aligning the defi nition of home position see description of command DFH with index pulse The user can aiso arrange to have the 1 M628 interrupt the host to signify that an index pulse has occured the descriptions for commands MSKI and RSTL COMMAND Load Position Error for interrupt Command Code 1B Hex Data Bytes Two Data Range 0000 to Hex Executable During Motion Yes An excessive position error the output of the loop summing junction can indicate serious system problem eg a stalled rotor instruction LPEI allows the user to input a threshold for position error detection Error detection occurs when the absolute magnitude of the position error exceeds the threshold which results in bit 5 of the status byte being get to logic high If it is desired to also stop turn off the motor upon detecting excessive position error See mand LPES below first byte of threshold data written with command is the more significant The user can have the 134628 interrupt host to signify that an exces sive position error has occurred See the descriptions for commands MSKI and ASTI Interrupt Control Commands continued LPES COMMAND Loa
96. here is a simple test to determine accidental over voltage reverse voltage or other forced current situations Unplug the card from the bus and remove all cables Using an ordinary digital ohmmeter on the 2 000 ohm scale measure the resistance between power and ground Record this number Reverse the ohmmeter leads and measure the resistance again If the ratio of the resistances is 2 1 or greater fault conditions most likely have occurred A common cause is miswiring the power supply Improper power causes catastrophic failure f a card has had reverse polarity or high voltage applied replacing failed component is not an adequate fix Other components probably have been partially damaged or a failure mechanism has been induced Therefore a failure will probably occur in the future For such cards Octagon highly recommends that these cards be replaced Other over voltage symptoms In over voltage situations the programmable logic devices EPROMs and CPU chips usually fail in this order The failed device may be hot to the touch It is usually the case that only will be overheated at a time Power sequencing The major failure of I O chips is caused by the external application of input voltage while the Micro PC power is off If you apply 5V to the input of a TTL chip with the power off nothing will happen Applying a 5V input toa CMOS card will cause the current to flow through the input and out the 5V power pin T
97. hioh of the four filter parameters nificant byte Prior to writing a word byte pair it is neces is are to be written via any forthcoming data bytes The first to check the busy bit in the status byte for readiness byte written is the more significant Thus the two data bytes The required data is written to the primary buffers of a dou constitute a fiter control word that informs the LM628 as to ble buffered scheme by the above described operations it the nature and number of any following data bytes See is not transferred to the secondary working registers until Table IV the UDF command is executed This fact can be used ad vantageously the user can input numerous data ahead of TABLE IV Filter word Allocation their actual use This simple pipeline effect can relieve po tential host computer data communications bottlenecks and facilitates easier synchronization of multiple axis con Derivative Sampling Interval Bit 7 trols Derivative Sampling Interval 6 UDF COMMAND UpDaie Filter Derivative Sampling Interval Bit 5 Command Code 04 Hex Derivative Sampling Interval Bit 4 Data Bytes None Derivative Sampling Interval Bit 3 Executable During Motion Yes Derivative Sampling Interval Bit 2 The UDF command is used to update the filter parameters 9 Derivative Sampling Interval Bit 1 the specifics of which have been programmed via the LFiL B Derivative Sampling Interval Bit 0 command Any or all parameters deriva
98. his current attempts to power up the card Most inputs are rated at 25 mA maximum When this is exceeded the chip may be damaged Failure on power up Even when there is not enough current to destroy an input described above the chip may be destroyed when the power to the card is applied This is due to the fact that the input current biases the so that it acts as a forward biased diode on power up This type of failure is typical on serial interface chips Using CMOS Circuitry 3 Serial and parallel Customers sometimes connect the serial and printer devices to the Micro PC while the power is off This can cause the failure mentioned in the above section Failure upon power up Even if they are connected with the Micro PC on there can be another failure mechanism Some serial and printer devices do not share the same power AC grounding The leakage can cause the serial or parallel signals to be 20 40V above the Micro PC ground thus damaging the ports as they are plugged in This would not be a problem if the ground pin is connected first but there is no guarantee of this Damage to the printer port chip will cause the serial ports to fail as they share the same chip Hot insertion Plugging cards into the card cage with the power on will usually not cause a problem Octagon urges that you do not do this However the card may be dam aged if the right sequence of pins contacts as the card is pushed into the socket This us
99. inearity and monotonicity errors Two methods exist for making this adjustment If the DAC1210 has been socketed remove it and temporarily connect 15 resis tor between Pins 11 and 13 of the DAC socket Pins 2 and 6 of the LF356 and adjust the 25 potentiometer for OV at Pin 6 of the LF356 if the DAC is not removable the second method of adjust ment requires that the DAC1210 inputs be presented an all zeros code This can be arranged by commanding the ap propriate move the LM828 but with no feedback from the system encoder When the all zeros code is present adjust the pot for OV at Pin 6 of the LF356 17 Monollihic Linear Drive Using LM12 Power Amp Figure 15 shows a motor drive amplifier built using the LM12 Power Operational Amplifier This circuit is very simple and can deliver up to 8A at 30V using the LM12L LM12CL Resistors R1 and R2 should be chosen to set the gain to provide maximum output voltage consistent with maximum input voltage This example provides gain of 2 2 which allows for amplifier output saturation at 22V with a t 10V input assuming power Supply voltages of 30V The ampli fier gain should not be higher than necessary because the system is nonlinear when saturated and because gain should be controlled by the LM628 The LM12 can also be configured as a current driver see 1987 Linear Databook Vol 1 p 2 280 Typical PWM Motor Drive interfaces Figure 16 shows an LM18296
100. ing junction The error signal is saturat ed at 16 bits to ensure predictable behavior In addition to being multiplied by filter coefficient kp the error signal is added to an accumulation of previous errors to form the integral signal and at rate determined by the chosen de rivativa sampling interval the previous error is subtracted from it to form the derivative signal filter multiplications 16 bit operations only the bottom 16 bits of the product are used The integral signal is maintained to 24 bits but only the top 16 bits are used This scaling technique results in more usable less sensitive range of coefficient ki values The 16 bits are right shifted eight positions and multiplied by filter Coefficient ki to form the term which contributes to the mo tor control output The absolute magnitude of this product is compared to coefficient il and the lesser appropriately signed magnitude then contributes to the motor control sig nal The derivative signal is multiplied by coefficient kd each de fivative sampling interval This product contributes to the motor control output every sample interval independent of the user chosen derivative sampling interval The kp limited ki and kd product terms are summed to form 16 04 quantity Depending on the output mode wordsize either the top 8 or top 12 bits become the motor control output signal 628 READING AND WRITING OPERATIONS The host processor write
101. ing the 1 628 The host processor communicates with the 1 628 through an port to facili tate programming a trapezoidal velocity profile and a digital compensation filter The DAC output interfaces to an exter digital to analog converter to produce the signal that is power amplified and applied to the motor An incremental encoder provides feedback for closing the position servo loop The trapezoidal velocity profile generator calculates the required trajectory for either position or velocity mode of operation operation the L626 subtracts the actual po sition feedback position from the desired position profile generator position and the resulting position error is pro cessed by the digital fiter to drive the motor to the desired position Table provides a brief summary of specifications offered by tho LMG28 LM6C29 POSITION FEEDBACK INTERFACE The 1 628 interfaces to motor an incremental encod er Three inputs are provided two quadrature signal inputs and an index pulse input The quadrature signals are used to keep track of the absolute position of the motor Each time logic transition occurs at one of the quadrature in puts the L628 internal position register is incremented decremented accordingly This provides four times the reso lution over the number of lines provided by the encoder See Figure 9 Each of the encoder signal inputs is synchro nized with the LM628 clock The optiona
102. initialization section of the filter tuning program is exe cuted to prepare the system for filter tuning See Figure 22 This section initializes the system presets the filter parame ters Kp kj 0 kg 2 ds 1 and commands the control loop to hold the shaft at the current position After executing the initialization section of the filter tuning program both desired and actual shaft positions equal zero the shaft should be stationary Any displacement of the shaft constitutes a position error but with both kp and set to zero the control loop can not correct this error 2 Determine the Derivative Gain Coefficient The filter differential term provides damping to eliminate os cillation and minimize overshoot and ringing stabilize the system Damping is provided as a force proportional to the rate of change of position error and the constant of propor tionality is kq X ds See Figure 21 Coefficients and ds are determined with an iterative pro cess Coefficient kq is systematically increased until the shaft begins high frequency oscillations Coefficient d is then increased by one The entire process is repeated until ds reaches a value appropriate for the system 15 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 It sets the time interval between successive posit
103. ion error samples used in the differential term and therefore directly affects system damping The derivative sampling in terval should be five to ten times smaller than the system mechanical time constant this means many systems will require low ds general however and ds should be set to give the largest X ds product that maintains accept ably iow motor vibrations Note Starting at two and doubling is good method of increasing Manually turning the shalt reveals that with each increase of the resistance of the shaft ta tuming increases The shaft feels increas ingly stuggish and because ky provides a force proportional to the tate of change of position error the faster the shaft is tumed the more sluggish it feeis For the reference system the final values of ky and ds are 4000 and 4 respectively Proportional Term output error TL H 10860 19 integral Term output TL H 1086020 Differential Term Ta Aarror TL H 10860 21 FIGURE 21 Proportional Integral and Differential PID Force Components Port Bytes Command Comments 00 RESET wait 2 Busy bit Check Module RSTI Busy bit Check Module HB LB Busy bit Check Module MSKI Busy bit Check Module HB 94 LB Busy bit Check Module LFIL Busy bit Check Module ig Busy bit Check Module See Initialization Module T
104. it 6 of the Status byte is set to logic high when the breakpoint position relative to the current commanded target position is reached The relative breakpoint input value must be such that when this value is added to the target position the result remains within the absolute position range of the system C0000000 to 3FFFFFFF hex This condition is useful for Signaling trajectory end or filter parameter updates The user can also arrange to have the LM628 interrupt the host to signify that a breakpoint position has been reached See the descriptions for commands MSKI and RSTI MSKI COMMAND MaSK Interrupts Command Code 1 Hex Data Bytes Two Oata Range See Text Executable During Motion Yes command lets the user determine which potential interrupt condition s will interrupt the host Bits 1 through 6 of the status byte are indicators of the six conditions which candidates for host interrupt s When interrupted the host then reads the status byte to leam which condition s occurred Note that the MSKI command is immediately fol lowed by two data bytes Bits 1 through 6 of the second less significant byte written determine the masked un masked status of each potential interrupt Any zero s in this 6 bit field will mask the corresponding interrupt s any one s enable the interrupt s Other bits comprising the two bytes have no effect The mask controls only tha host inter rupt process reading the status
105. it Check Module c 91 18 00 02 oc d 4A 01 1D d 90 20 00 02 71 00 Port Bytes Command Comments STT Start motion control Busy bit Check Module LTRJ This command initiates loading the trajectory parameters input buffers Busy bit Check Module H8 These two bytes are the LB trajectory control word A 18 hex HB programs forward direction velocity mode operation hex LB indicates only velocity will be loaded and it will be a relative value Busy bit Check Module HB Velocity is loaded two data LB words These two bytes are the high data word in this case velacity is 2 0 rev s Because this is a relative value the current velocity will be increased by 2 0 rev s The resultant velocity will be 4 0 rev s Busy bit Check Module HB velocity data word low LB wait This wait represents the host processor waiting for an LM628 breakpoint interrupt SIT Start motion control Busy bit Check Module RST Reset interrupts Busy bit Check Module HB don t care LB Zeros in bits one through six reset all interrupts Busy bit Check Module SPBA This command initiates loading an absolute breakpoint Busy bit Check Module HB A breakpoint is loaded in LB data words These two bytes are the high data word this case the breakpoint is 160 000 counts absolute Busy bit Check Module HB breakpoint data word l
106. its quadrature decoder PID filter 625 quadrature decoder National Semiconductor Application Note 693 Steven Hunt April 1990 REFERENCE SYSTEM Figure 18 is detailed schomatic of ctosed lcop motor control system All programs presented in this paper were developed using this system For application of the pro grams in other LMG628 based systems changes basic programming structure are not required but modification of filter coefficients and trajectory parameters may re quired 1 PROGRAM MODULES Breaking programs for the LM628 into sets of functional blocks simplifies the programming process each block exe cutes a specific task This section contains examples of the principal building blocks modules of programs for the 1M628 quadrature incremental encoder FIGURE 1 LM628 Based Motor Control System control lines cC y motor quadrature incremental encoder TH 0860 2 FIGURE 2 LM629 Based Motor Control System 81990 National Semiconductor Corvaton TL HZ T0860 RRE B20M80 Priwed in V 829111 69 NV BUSY BIT CHECK MODULE The first module required for successful programming of the LM628 is a busy bit check module The busy bit bit zero of the status byte is set immediately after the host writes a command byte or reads or writes the second byte of a data word See Tab e While the
107. ives 1 2 Brief Description of LM628 629 2 0 DEVICE DESCRIPTION 2 1 Hardware Architecture 2 2 Motor Position Decoder 2 3 Trajectory Protile Generator 2 4 Definitions Relating to Profile Generation 2 5 Generation 2 6 Trajectory Aesolution 2 7 Position Velocity and Acceleration Resolution 2 8 Velocity Mode 2 9 Motor Output Port 2 10 Host Interface 2 11 Hardware Busy Bit Operation 2 12 Filter Initial Values and Tuning 3 0 USER COMMAND SET 3 1 Overview 3 2 Host LM628 629 Communication the Busy Bit 3 3 Loading the Trapezoidal Velocity Profile Generator 3 4 Loading Filter Coefficients 3 5 Interrupt Contro Commands 3 6 Data Reporting Commands 3 7 Software Example 4 0 HELPFUL USER iDEAS 4 1 Getting Started 4 2 Hardware 4 2 1 Host Microcontrolter Interface 4 2 2 Position Encoder Interface 4 2 3 Output Interface 4 3 Software 41000 Nabonsi Semeconducto Corporabon TL H 11018 National Semiconductor Application Note 706 David Dale August 1990 Table of Contents 4 4 Initialization 4 4 1 Hardware RESET Check 4 4 2 Initializing LM628 Output Port 4 4 3 Interrupt Commands 4 5 Performance Refinements 4 5 1 Derivative Sample Rate 4 5 2 Integral Windup 4 5 3 Profiles other than Trapezoidal 4 5 4 Synchronizing Axes 4 6 Operating Constraints 4 6 1 Updating Acceleration on the Fly 4 6 2 Command Update Rate 5 0 THEORY 5 1 PID Filter 5 1 1 PID Filter in the Continucus Domain 5 1 2 PID Filter Bode Plots
108. l index pulse output provided by some encoders assumes the logiclow state once per revolution If the 1 628 is 80 programmed by the user it will record the ab solute motor position in a dedicated ragister the index reg ister at the time when all three encoder inputs are logic iow If the encoder does not provide an index output tha LM628 index input can aiso be used to record the home position of the motor In this case typically the motor will close switch which is arranged to cause a logic low level at the index input and the 1 628 will record motor position in the index register and alert interrupt the host processor When using the index input in this manner the user should assure that the index input does not remain logic low during shaft rotation because LM628 internal interrupts are generated every lime three encoder inputs are logic low These temal interrupts will cause the LM628 to malfunction if the velocity is faster than about 15 000 counts second when using amp 6 MHz clock or about 20 000 counts second with an 6 MHz clock TABLE 1 System Specifications Summary Oto 1 073 741 823 216 counts sample ie 010 16 383 counts sample with a resolution of 1 216 Oto 1 073 741 823 216 counts sample sample ie 0 to 16 383 counts sample sample with 1988 Semiconductor Corporation Proportional Integral Derivative PID plus programmable integration limit Derivative Term Program
109. le module the first byte of the trajectory contro word x1 hex selects motor off as the de sired stopping mode This mode stops shaft motion by set ting the motor drive signal to zero the appropriate offset bi nary code to apply zero drive to the motor Setting bit nine of the trajectory control word selects stop abruptly as the desired stopping mode This mode stops shaft motion at maximum deceleration by setting the target position equal to the current position Setting bit ten of the trajectory contro word selects stop smoothly as the desired stopping mode This mode stops shaft motion by decelerating at the current user pro grammed acceleration rate Note Bits eight through ten of the trajectory control word must be used exclusively only one of them should be logic one at any time Start Motlon Controt The start motion control command STT must be executed to stop shaft motion Comments After shaft motion is stopped with either an abrupt or a smooth stop module the control system will attempt to hold the shaft at its current position If forced away from this desired resting position and released the shaft will move back to the desired position Uniess new trajectory parame ters are loaded execution of another STT command will restart the specified move After shaft motion is stopped with a motor off stop mod ule desired shaft position tracks actual shaft position Con sequently the motor drive si
110. location Bit Position Function 8815 Not Used Not Used Not Used 12 Forward Direction Velocity Mode Only Bit 11 Velocity Mode BRIG Stop Smoothiy Decelarate as Programmed Bi 9 Stop Abruptly Maximum Deceleration Bit 8 Turn Off Motor Output Zero Drive Bu 7 Not Used Bil 6 Not Used Bit 5 Acceleration Wil Be Loaded Bit 4 Acceleration Date Is Relative 3 Velocity Wii Be Loaded Bit 2 Velocity Data 16 Relative 1 Position Will Be Loaded Bit 0 Position Data is Relative Bit 12 determines the motor direction when in the velocity mode A logic one indicates forward direction This bit has no effect when in position mode Bit 11 determines whether the LM628 operates in velocity mode Bit 11 logic one or position mode Bit 11 logic zero Bits 8 through 10 are used to select the method of manually Stopping the motor These bits are not provided for one to merely specify the desired mode of stopping in position mode operations normal stopping is always smooth and Occurs automatically at the end of the specified trajectory Under exceptional circumstances it may be desired to man ually intervene with the trajectory generation process to af fect premature stop In velocity mode operations er the normal means of stopping 8 bits 8 through 10 usually bit 10 Bit is set to one to stop the motor by turning off motor drive output outputting the appropriate of set binary code
111. m must demonstrate simple trajectory parameters calculations the program must dem onstrate the programming flow required to load and execute an absolute position move and correct completion of the move must be verifiable through simple observation Move The shaft will accelerate at 0 1 rev sec until it reaches a maximum velocity of 0 2 rev sec and then decei erate to a stop exactly two revolutions from the starting po Sition See Figure 10 Note Absolute position is position measured relative to zero home An absolute position move is a move that ends at a specified absolute position For example independent of the current absoluta position of the shaft if an absolute position of 30 000 counts is specified upon completion of the mova the absolute position of the shaft will be 30 000 counts 30 000 counts relative to zero The example pro gram calls for a position move of two revolutions Because the start ing absolute position is 0 counts the move is accomplished by speci fying an absolute position of 8000 counts See Figure 13 The Quadrature Incremental Encoder As a supplement to the trajectory parameters calculations a brief discussion is provided here to differentiate between encoder fines and encoder counts quadrature incremental shaft encoder encodes shaft rota tion as electrical pulses Figure 71 details the signals gener ated by a 3 channel quadrature incremental encoder The LM628 decodes or counts
112. mable from 2048 to 2048 256 steps of 2048 fcLk 256 to 65 536 ps for 8 0 MHz clock Proportional and Integral 2048 Position Range 1 073 741 824 to t 073 741 823 counts Velocity Range counts sample Acceleration Range resolution of 1 218 counts sample sample Motor Drive Output LM628 8 bit parallel output to DAC or 12 bit multiplexed output to DAC LM629 8 bit PWM sign magnitude signals Operating Modes Position and Velocity Feedback Device incremental Encoder quadrature signals support for index pulse Control Algorithm Sample intervals Theory of Operation 20 1 142154111213 4 e tl be FIGURE 9 Quadrature Encoder Signals TL H 92 19 14 oe STANDARD TRAPEZOIDAL PROFILE VELOCITY RO MODIFIED TRAPEZOIDAL PROFILE STOPPING POSITION 5 INTEGRAL OF TL H 9219 12 FIGURE 10 Typical Velocity Profiles VELOCITY PROFILE TRAJECTORY GENERATION The trapezoidal velocity profile generator computes the de sired position of the motor versus time the position mode of operation the host processor specifies acceleration maximum velocity and final position The LM628 uses this information to affect the move by accelerating as specified until the maximum velocity is reached or until deceleration must begin to stop at the specified final position The decel eration rate is equal to the acc
113. n 11 mediately executed This command must not be issued whan using an 8 bit converter or the 29 the PWM out put version of the LM628 DFH COMMAND DeFine Home Command Code 02 Hex Daia Bytes None Executable During Motion Yes This command declares the current position home or absolute position 0 Zero If is executed during motion it wil not affect the stopping position of the on going move untess command STT is also executed Interrupt Control Commands The following seven LM626 user commands are associated with conditions which can be used to interrupt the host com puter In order for any of the potential interrupt conditions to actually interrupt the host via Pin 17 the corresponding bit in the interrupt mask data associated with command MSKI must have baen set to logic high the non masked state The identity of all interrupts is made known to the host via reading and parsing the status byte Even if all interrupts are masked off via command MSKI the state of each condition is still reflected in ihe status byte This feature facilitates polling the LM628 for status information as opposed to in terrupt driven operation iP COMMAND Set index Position Command Code 03 Hox Data Bytes None Executable During Motion Yes After this command is executed the absolute position which corresponds to the occurrence of the next index pulse input will be recorded in the index register and bit 3 of t
114. n is the integral of the velocity profile STANDARDS TRAPEZOIDAL VELOCITY PROFILE VELOCITY LIMITING VELOCITY EQUAL RATES OF ACCELERATION AND DECELERATION STOPPING POSITION 15 INTEGRAL TRAPEZOID TAH 1018 5 FIGURE 5 Typical Trajectory Velocity Profile When performing a move the LM628 529 uses the informa tion as specified by the host and accelerates until the target velocity is reached While doing this it takes note of the number of counts taken to reach the target velocity This number of counts is subtracted from the target position to determine where deceleration should commence to ensure the motor stops at the target position LM628 629 decelera tion rates are equal to the acceleration rates In some cas es depending on the relative target values of velocity ac celeration and position the target velocity will not be reached and deceleration will commence immediately from acceleration 2 6 Trajectory Resolution The resolution the motor sees for position is one integral count The algorithm used to calculate the trajectory adds the velocity to the current desired position once per sampte period and produces the next desired position point In or der to allow very low velocities it is necessary to have veloc ities of fractional counts per sample The LM628 629 in ad dition to the 32 bit position range keeps track of 16 bits of fractional position The need for fractional velocity counts
115. n of motion is forward zero indicates reverse direction Bit 12 is set and cleared via command The actual setting and clearing of bit 12 does not ooour until command STT executed Bit 11 the velocity mode flag is set to logic ona to indicate that the user has selected via command LTAJ velocity mode Bit 11 is cleared when position mode is selected via command The actual setting and clearing of bit 11 does not occur until command STT executed Bit 10 the on target flag is set to logic one when the trajec tory generator has completed its functions for the last is sued STT command Bit 10 is cleared by the next STT com mand Bit 9 the turn off on error flag is set to logic one when command LPES is executed Bit 9 is cleared by command LPEL Bit 8 the B bit output flag is set to logic one when the LM628 is reset or when command PORTS is exeouted Bit 8 is cleared by command PORT12 Bits 0 through 7 replicate the status byte see Tabie Vil with the exception of bit 0 Bit 0 the acquire next index flag is set to logc one when command SIP is executed it than remains set until the next index pulse occurs RDIP COMMAND ReaD index Position Command Code 09 Hex Bytes Read Four Data Range C0000000 to 3FFFFFFF Hex Executable During Motion Yes This command reads the position recorded in the index reg ister Reading the index register can be part of a system error checking scheme Whenever the
116. n profile The bytes are read most to least significant order The value read is properly scaled for numerical comparison with the user sup plied commanded velocity however because the two least significant bytes represent fractional velocity only the two most significant bytes are appropriate for comparison with the data obtained via command RDRV see below Also note that although the velocity input data is con strained to positive numbers see command LTRJ the data returned by command RDDV represents a signed quantity where negative numbers represent operation in the reverse direction RDRV COMMAND ReaD Real Velocity Command Code OB Hex Bytes Read Two Data Range C000 to 3FFF Hex See Text Executable During Motion Yes This command reads the integer portion of the instanta neous actual velocity of the motor The intemally maintained fractional portion of velocity is not reported because the reported data is derived by reading the incremental encod er which produces only integer data For comparison with the result obtained by executing command RDDV the user supplied input value the value returned by command RDRV must ba multiplied by 216 shifted left 16 bil posi tions Also as with command RDDV above data returned by command RORV is a signed quantity with negative val ues representing reverse direction motion ROSUM COMMAND ReaD Integration Term SUMmation Value Command Code 00 Hex Bytes Read
117. n the motor will restart and move to the target position in position mode or resume movement in velocity mode 6 4 More on Define Home 8 4 1 What happens if the Define Home command DFH 18 issued while a current trajectory is progress Answer The position where the DFH command is issued is reset to zero bul the motor still stops at the original position commanded i e the position where DFH is issued is sub stracted from the original target position 8 4 2 Does issuing Define DFH zero both the tra Jectory and position register Answer Yes use Read Position RDRP and Read De sired Position RDDP to verify 8 5 More on Velocity 6 5 1 Why is a command error interrupt generated when inputting negative values of relative velocity Anawer Because the negative relative velocity would cause negative absolute velocity which is not allowed Negative absolute values of velocity imply movement in the negative direction which can be achieved by inputting a negative po sition value or in velocity mode by not setting bit 12 Similar ly n gative values of acceleration imply deceleration which occurs automatically at the acceleration rate when the LM628 629 stops the motor in position mode or if making a transition from a higher to a lower value of velocity 6 5 2 What happens in velocity or position mode when the position range is exceeded Answer The position range extends from maximum nega tive posi
118. nd Comments 1C d xx d 40 21 4 00 4 01 4 38 4 18 28 00 00 00 11 d 00 4 02 d oc d 4A Initialization Module Filter Programming Module MSKI Mask interrupts Busy bit Check Module HB don t care LB A 40 hex LB enables unmasks the breakpoint interrupt All other interrupts are disabled masked Busy bit Check Module SPBR This command initiates loading a retative breakpoint Busy bit Check Module H8 A breakpoint is loaded in two 1B data words These two bytes are the high data word In this case the breakpoint is 80 000 counts relative to the current commanded target position zero Busy bit Check Module HB breakpoint data word low LB Busy bit Check Module LTRJ Load trajectory Busy bit Check Module HB These two bytes are the LB trajectory control word A 18 hex HB programs forward direction velocity mode operation A 28 hex LB indicates acceleration and velocity will be loaded and both values are absolute Check Module HB Acceleration is loaded in two LB data words These two bytes are the high data word In this case the acceleration is 1 0 2 Busy bit Check Module HB acceleration data word low Busy bit Check Module HB Velocity is loaded in two data LB words These two bytes are the high data word In this case velocity is 2 0 rev s Busy bit Check Module HB velocity data word low LB Busy b
119. nd decelera tion is determined ex 256 10 8 2 5SECONDS _ number of samples 256x 10 6 SECONDS 9766 SAMPLES during acceleration x10 6 22220895 1 SAMPLE Using the number of counts traveled during acceleration and the number of samples during acceleration accelera tion is determined _ 8 distance traveled during 2 time tat acceleration a _ 28 _ 2 12 000 COUNTS _ COUNTS 9766 SAMPLES 0 000252 Total counts traveled while at maximum velocity is four fifths the total counts traveled 120 090 COUNTS 5 tAverage velacity during acceleration and deceleration periods is one half the maximum velocity 96 000 COUNTS 10 Port Bytes Command Comments 4 00 2B d 00 00 90 d 11 9 00 02 9 75 FE d 2B d 40 01 initialization Module Filter Programming Module LTRJ This command initiates loading the trajectory parameters input buffers Busy bit Check Module HB These two bytes are the tB trajectory control word A 2B hex LB indicates all three parameters will be loaded and both acceleration and velocity will be absolute values while position will be a relative value Busy bit Check Module HB Acceleration is loaded in two LB data words These two bytes are the high data word this case the acceleration is 17 counts sample Busy bit Check Module HB acceleration data word low LB Busy bit
120. nd released the shaft springs back If kp is too low the system is over damped and the shaft recovers too slowly If kp is too large the system is under damped and the shaft recovers too quickly This causes overshoot ringing and possibly oscilla tion The proportional gain coefficient kp is increased to the largest value that does not cause excessive overshoot or ringing At this point the system is critically damped and therefore provides optimum tracking and settling time Note Starting kp at two and doubling it at each iteration is good method of increasing kp The final value of kp for the reference system is 40 4 Determine the Integral Gain Coefficient The filter proportional term minimizes the errors due to iner tial and torque loading The integral term however provides a corrective force that can eliminate following error while the shaft is spinning and the deflection effects of a static torque load while the shaft is stationary This corrective force is proportional to the position error and increases lin early with time See Figure 21 The integral gain coefficient is the constant of proportionality High values of k provide quick torque compensation but increase overshoot and singing general should be set to the smallest value that provides the appropriate compro mise between three system characteristics overshoot set tling time and time to cancel the effects of a static torque ioad in sys
121. nds because it is used very fre quently to control communications with the host computer There is no identification code it is directly supported by the hardware and may be executed at any time The single byte status read is selected by placing CS and FID at logic zero See Table Vil TABLE VIL Statue Bit Allocation Motor Off Breakpoint Reached interrupt Excessive Position Error interrupt Wraparound Occurred interrupt Index Puise Observed Interrupt Trajectory Complete Interrupt Command Error Interrupt Busy Bit Bit 7 motor off flag set to logic one when the motor drive output is off at the half ecale offset binary code for zero The motor is turned off by any of the following condi tions power up reset command RESET excessive position error if command LPES had been executed or when com mand LTRJ is used to manually stop the motor via turning the motor off Note that when bit 7 is set in conjunction with command LTRJ for producing a manual motor off stop the actual setting of bit 7 does not occur until command STT is issued to affect the stop Bit 7 is cleared by command STT except as deacribed in the previous sentence Bit 6 the breakpoint reached interrupt flag is set to logic when the position breakpoint foaded via command 5 or 5 has been exceeded The flag is functional independent of the host interrupt mask status Bit 6 is cleared via command RSTI Bi
122. nk Preface 4 CHAPTER 1 OVERVIEW Motion Control Cards are used to control the position and direction of motors The 5328 Motion Control Card can be used with servomechanisms that provide a quadrature feedback signal for example an incremental encoder or X Y positioning system The 5328 Motion Control Card is a complete motion control unit Both accept position signals from a quadrature encoder and compute a PID Proportional Integral Derivative algorithm The 5328 provides an analog feedback signal DAC to the motor controller The 5328 has one channel the 5328 2 has two channels This measures 4 5 x 4 9 inches and uses one slot of the Micro PC card cage The Micro PC Control Card in your system initially writes the set of control conditions to the Motion Control Card The on card intelligent controller then maintains control of the motor alleviat ing the work load on the control card The 5328 uses the LM628 and LM629 Precision Motion Control chips from National Semiconductor Corporation These chips perform the intensive real time computational tasks needed for high performance digital motion control For more information on the LM628 and LM 629 characteristics please refer to Appendix B and to Special Purpose Linear Devices Databook by National Semiconductor Corporation Overview 5 HOW WORKS The Micro PC Control Card communicates with the 5328 through an 1 port making it easy to program a trape
123. o gt TL H 9219 3 Order Number LM628N 6 LM628N 8 LM629N 6 LM629N 8 See NS Package Number N28B 1989 Notional Semiconductor Corporation 49104 05 UONOW 01512914 669W1 869W T1 i Absolute Maximum Ratings 1 if Military Aerospace specified devices are required piease contact the National Semiconductor Sales Office Distributors for avallability and specifications Voltage at Any Pin with Respect to GND Pin 14 0 3V to 7 0V Ambient Storage Temperature 65 Cto 180 C Lead Temperature Soldering 4 sec 260 C Maximum Power Dissipation 550 mW ESD Tolerance Czap 120 pF Rz4p 1 5k 2000V Operating Ratings Temperature Range Clock Frequency LM62BN 6 LMG28N 6 LM628N 8 LM629N 8 Vpp Ranga 40 lt TA lt 85 1 0 MH2 lt feik lt 6 0 MHz 1 0 MHz lt lt 8 0 MHz 4 5 lt Vpp lt 5 5 DC Electrical Characteristics and TA per Operating Ratings 6 MHz Parameter Supply Current TRI STATE Output Leakage Current AC Electrical Characteristics oae ww osvwwsvp 0 T eism 21 21 osons and TA per Operating Ratings 6 MHz 50 pF input Test Signal 1 t 10 ns Timing interval ENCODER AND INDEX TIMING See Figure 2 Motor Phase Pulse Width 8 1000 Sem
124. of multipla axes 3 2 Host LM628 629 Communication The Busy Bit Communication flow between the LM628 829 and its host is controlled by using a busy bit bit 0 in the Status Byte The busy bit must be checked to be at logic 0 by the host before commands and data are issued or data is read This includes between data byte pairs for commands with multi ple words of data 3 3 Loading the Trapezoidal Velocity Profile Generator To initiate a motor move trajectory generator values have to be input to the LM628 629 using the Load Trajectory Parameters LTRJ command The command is followed by trajectory control word which details the information to be loaded in subsequent data words Table gives the bit allo cations a bit is set to logic 1 to give the function shown Underdamped TABLE I Trajectory Control Word Bit Allocations BitPosition Function Not Used Not Used Not Used Forward Direction Velocity Mode Only Velocity Mode Stop Smoothly Decelerate as Programmed Stop Abruptly Maximum Deceleration Turn Off Motor Output Zero Drive Not Used Not Used Acceleration Will Loaded Acceleration Data Is Relative Velocity Will Be Loaded Vatocity Data is Relative Position Will Be Loaded Position Data is Relative aw MOR om st Bits 0 to 5 determine whather any all or none of the posi tion velocity or acceleration values are loaded and whether they are absolute values or values relative to
125. ol loop will be non linear The acceleration and velocity values should be set within the capability of the motor Read Desired and Real Position commands and RDRP can be used to determine the size of the error The Load Position Error commands for either host interrupt or motor Stopping LPEI and LPES can be used to monitor the error size for controlled action where safety is a factor 6 6 6 When is the command error bit 1 in the Status Byte set Answer 8 When an acceleration change is attempted when the mo tor is moving and the drive on b When loading a relative velocity would cause a negative absolute velocity incorrect reading and writing operations generally 6 6 7 What does the trajectory complete bit 2 in the Status Byte indicate Answer That the trajectory loaded by and initiated by STT has completed The motor may or may not be at this position Bit 2 is also set when the motor stop commands ara executed and completed 6 6 8 What do the specified minimum and maximum val ues of velocity mean in reality Answer Assume a 500 line encoder 1 2000 revs count is used The maximum 628 629 velocity is 16383 counts sample and for 8 MHz the LM628 629 sample rate is 3 9 samples second multiplying these values gives 32k revs second or 1 92M rpm The maximum encoder rate is 1M counts second multiplied by 1 2000 revs count gives 500 revs second or 30k rpm The encode
126. on against all damage Please read before installing your product Octagon s products are designed to be high in performance while consuming very little power In order to maintain this advantage CMOS circuitry is used CMOS chips have specific needs and some special requirements that the user must be aware of Read the following to help avoid damage to your card from the use of CMOS chips Using CMOS Circuitry 1 Using CMOS Circuitry in Industrial Control Industrial computers originally used LSTTL circuits Because many PC components are used in laptop computers manufac turers are exclusively using CMOS technology Both TTL and CMOS have failure mechanisms but they are different This section describes some of the common failures which are common to all manufacturers of CMOS equipment However much of the information has been put in the context of the Micro PC Octagon has developed a reliable database of customer induced field failures The average MTBF of Micro PC cards exceeds 11 years yet there are failures Most failures have been identified as customer induced but there is a small percentage that cannot be identified As expected virtually all the failures occur when bringing up the first system On subsequent systems the failure rate drops dramatically Approximately 20 of the returned cards are problem free These cards typically have the wrong jumper settings or the customer has
127. ounts relative to position zero the current target position This represents a move of twenty forward direc tion revolutions When this position is reached the LM628 interrupts the host processor and the host executes se quence of commands that increases the maximum velocity resets the breakpoint interrupt flag and loads an absolute breakpoint The example program contains an absolute breakpoint set at 160 000 counts When this absolute position is reached the LM628 interrupts the host processor and the host exe cutes a Smooth Stop Module Breakpoint positions for this example program are deter mined COUNTS 4000 BEVOLUTION 20 REVOLUTIONS 80 000 COUNTS COUNTS soem x 40 REVOLUTIONS 4000 absolute 160 000 COUNTS reakpoint Load Trajectory Parameters This example program contains two LTRJ command se quences The trajectory control word of the first com mand sequence 1828 hex programs forward direction ve locity mode and indicates an absolute acceleration and an absolute velocity will be loaded The trajectory control word of the second command sequence 180C hex pro grams forward direction velocity mode and indicates tive velocity will be loaded See Table V Trajectory parameters calculations follow the same format as those detailed for the simple absolute position move See Figure 12 12 Port Bytes Comma
128. ow LB wait This wait represents the host processor waiting for an 1 628 breakpoint interrupt Smooth Stop Module FIGURE 17 Basic Velocity Mode Move with Breakpoints Program 13 09801 1 0159 543 pw wg HHAH o soun 0001 30po2u3 80040 727 4999 guuwp c 5 q 9 6 SE HOA 20 878 LRVISNOO 200801 1270 IN34862 QYOT ON m s 0285 03345 QVO ON MOLS 300801 YY3d LY 33804 41 10 902 310401 TWIS 4 11015 Wir 8 914 1 10188601 SOON sna Y1YG QNVRHOS 508 14 TUNING THE PID FILTER BACKGROUND The transient response of a control system reveals impor tant information about the quality of control and because a step input is easy to generate and sufficiently drastic the transient response of a control system is often character ized by the response to a step input the system step re sponse turn the step response of a control system can be char acterized by three attributes maximum overshoot rise time and settling time These step response attributes are de fined in what follows and detailed graphically in Figure 18 1 The maximum overshoot Mp is the maximum peak val ue of the response curve measured from unity The amount of maximum overshoot directly indicates the r
129. ppears here 4 Paired angle brackets are used to indicate a specific key on your keyboard for example means the escape key CTRL gt means the control key lt 1 means the F 1 function key 5 All addresses are given in hexadecimal SYMBOLS AND TERMINOLOGY Throughout this manual the following symbols and terminology are used WI 1 NOTE PC SmartLINK TTL Compatible H Denotes a jumper block and the pins to connect Information under this heading presents helpful tips for using the 5328 Information under this heading warns you of situations which might cause catastrophic or irreversible damage A serial communications software package designed by Octagon It provides communica tions between a PC and other equipment and may be used with any PC software package induding CAMBASIC IV Refers to all versions of PC SmartLINK 0 5 logic levels The suffix H denotes a hexadecimal number For example 1000H in hexadecimal equals 4096 in decimal Preface 2 TECHNICAL SUPPORT If you have a question about the Motion Control Card and cant find the answer in this manual call Technical Support They will be ready to give you the support you need When you call please have the following at hand e Your 5328 Motion Control Card User s Manual description of your problem The direct line to Technical Support is 303 426 4521 Preface 3 This page intentionally left bla
130. pported by hardware Ld 1990 National Semiconductor Corporation 10 10 User Command Set GENERAL The foliowing paragraphs describe the user command set of the LM628 Same of the commands can be issued alone and some require supporting date structure As examples the command STT 5 motion does not require add tional date command Load Filter parameters quires additional date derivative term sampling interval and or fter parameters Commands are categorized by function initialization inter control fiter control trajectory control and data report ing The commands are listed in Table li and described in the following paragraphe Along with each command name is te command byte code the number of accompanying data bytes that are to be written or read and comment 88 to whether the command is executable during motion Initialization Commands The following four 1 628 user commands are used primari ly to initialize the system for use RESET COMMAND RESET the 146258 Command Cade 00 Hex Data Bytes None Executable During Motion Yes This command and the hardware reset input Pin 27 re suks in setting the following data items to zero filter coeffi cients and their input buffers trajectory parameters and their input buffers and the motor control output zero mo tor control output hal scale offset binary code BO hex for the 8 bit output mode 800 hex fo
131. r 12 bit mode During reset the DAC port outputs 800 hex to zero 12 bit DAC and reverts 10 80 hex to an B bit DAC The command also clears five of the six interrupt masks only the SBPA SBPR interrupt is masked sets the output port size to 8 bits and defines the current absolute position as home Reset which may be executed at any time will be complet ed in less than 1 6 Also see commands PORTS and PORT12 PORTS COMMAND Set Outpul PORT Size to 8 Bits Command Code 06 Hex Oata Bytes None Executable During Motion Not Applicable default output port size of the LM628 is 8 bits so the PORTS command need not be executed when using an amp bit DAC This command must not be executed when using 12 bit converter it will result in erratic unpredictable tor behavior The 8 bit output port size is the required selec tion when using the LM629 the PWM output version of the L M628 PORT12 COMMAND Set Output PORT Size 10 12 Blis Command Code 06 Hex Data Bytes None Executable During Motion Not Applicable When 12 bit DAC is used command 12 should be issued very in the initialization process Because use of this command is determined by system hardware there is only one foreseen reason to execute it later if the RESET command is issued because an 8 bit output would then be Selected as the default command 12 should be im 1909 Natana Semiconductor Corporatio
132. r capture rate therefore sets the maximum va locity limit The minimum LM628 629 velocity is 1 65536 counts sam ple one fractional count multiplying this value by the sam ple rate and encoder revs count gives 30 10 6 revs second or 1 8 x 10 3 rpm The LM628 provides no limitation to practical values of ve locity 6 6 9 How long will it take to get to position wraparcund in velocity mode traveling at 5000 rpm with a 500 line encoder Answer 107 minutas 7 0 REFERENCES AND FURTHER READING 1 LM628 LM629 Precision Motion Controller Data sheet March 1989 2 Automatic Control Systems Benjamin C Kuo Fifth edi tion Prentice Hall 1987 3 DC Motors Speed Controls Servo Systems Robbins amp Myers Electro Craft 4 PID Algorithms and their Computer Implementation D W Clarke Institute of Measurement and Control Trans v 6 No 6 Oct Dec 1984 86 178 5 LM628 Programming Guide Steven Hunt National Semi conductor Application Note AN 693 LM628 629 User Guide AN 706 LIFE SUPPORT POLICY SEMICONDUCTOR CORPORATION As used herein 1 Life support devices or systems are devices systems which are intended for surgical impiant into the body or b support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in a significant injury NATIONAL S PRODUCTS ARE NOT AUTHORIZED FO
133. r to badly overshoot and thus integral wind up has occurred 4 5 3 Profites Other Than Trapezoldal EQUAL RATES OF ACCELERATION AND DECELERATION VELOCITY TU H 11019 16 FIGURE 16 Generating a Non Trapezoidal Profile H it is required to have a velocity profile other than trapezoi dal this can be accomplished by breaking the profile into small pieces each of which is part of a small trapezoid piecewise linear approximation to the required profile can then be achieved changing the maximum velocity before the trapezoid has had time to complete soe Figure 16 4 8 4 Synchronizing Axes For controlling tightly coupted coordinated motion between multipie axes synchronization is required The best possible synchronization that can be achieved between multiple 1 628 629 is within one sample interval 2048 1 256 ps tor an 8 MHz clock 341 us for a 6 MHz clock This is achieved by using the pipeline feature of the LM628 629 where all controlled axes are loaded individually with trajec tory values using the LTRJ command and then simulta neously given the siart command STT PID filter coefficients can be updated in a similar manner using LFIL and UDF commands 4 6 Operating Constraints 4 6 1 Updating Acceleration on the Fly Whereas velocity and target position can be updated while the motor is moving on the the algorithm described in Section 2 5 prevents this for acceleration change a
134. rates the control per formed by the LM626 N 0 kd e n 1 Eq 1 whera u n is the motor control signal output at sample time n is the position error at sample time n n indi cates sampling at the derivative sampling rate and kp and kd are the discrete time filter parameters loaded by the users The first term the proportional term provides a restoring force porportional to the position error just as does a spring Obeying Hooke s law The second term the integration term provides a restoring force that grows with time and thus ensures that the static position error is zero If there is 1000 Natons Sa mconductor Corporation constant torque loading the motor will still be able to achieve zero position error The third term the derivative term provides a force propor tional to the rate of change of position error It acts just like viscous damping in a damped spring and mass system like shock absorber in an automobile The sampling interval associated with the derivative term is user seiectable this capability enables the LM628 to contro a wider range of inertial toads system mechanical time constants by provid ing a better approximation of the continuous derivative In general longer sampling intervals are useful for low velocity Operations In operation the filter algorithm receives 16 bit error signal from the loop summ
135. rection while in operation the status byte bit 4 is set and optionally can be used to inter the host The remaining 30 bits provide the available dynamic range of position in either the positive or negative direction 1 073 741 824 counts Velocity has a resoiution of 1 216 counts sample and ac celeration has a resolution of 1 216 counts sample sample as mentioned above The dynamic range is 30 bits in both cases The loss of one bit is due to velocity and acceleration being unsigned and another bit is used to detect wrap around This leaves 14 bits or 16 383 integral counts and 16 bits for fractional counts 28 Velocity Mode LM628 supports a velocity mode where the motor is com manded to continue at a specified velocity until it is told to Position LL Integer Ll Frection 4 TL H 11018 6 FIGURE 6 Position Velocity and Acceleration Registers stop LTRJ bits 9 or 10 Tha average velocity will be as specified but the instantaneous velocity will vary Velocities of fractional counts per sample will exhibit the poorest in stantaneous velocity Velocity mode is a subset of position mode where the position is continually updated and moved ahead of the motor without a specified stop position Care Should be exercised in the case where a rotor becomes locked while in velocity mode as the profile generator will continue to advance the position When the rotor becomes free high velocities will be attained to cat
136. rrupt output pin pin 17 of the LM628 LM629 This signal is generated by the combination of a trajectory complete interrupt and reset interrupts RSTI command See Flow Diagram 3 Note The circuit of Figure 24 can be used to view the step response of LM628 based system Observations What follows are example oscilloscope traces of the step response of the reference system Note 1 All traces were generated using the circuit of Figure 24 HCTL 2000 quadrature decoder 0800 converter phases and from encoder 1o scape trigger digitat to analog 12 from 1 628 1 629 pin 17 host interrupt output Note 2 Ali traces were generated using the following step trajectory pa rameters relative position 200 counts absolute velocity 500 000 counts sample acceleration 300 000 counts sample sample These values generated a good small signal step input for the ref erence system other systems will require different trajectory pa rameters in general step trajectory parameters consist of a small relative position a high velocity and a high acceteration The position parameter must be relative Otherwise a define home command must be added to the main loop of the step gener ation section filter tuning program See Flow Diagram 3 Tha circuit tor viewing the system step response uses 8 bit ana log to digital converter See Figure 24 To prevent converter over flo
137. ruction bus User variable filter and trajectory parameters are stored 32 04 double words To provide sufficient dynamic range a 32 bit position register is used and for consistency 32 bits are also used for velocity and acceleration values A 32 bit ALU is used to support the 16 x 16 bit multipiications of the error and PID digital filter coefficients 2 2 Motor Position Decoder LM628 829 provides an interface for an optical position shaft encoder decoding the two quadrature output signals one fom encoder line Index pulse A B 10 provide position and direction information Figure 3 tionally a third index position output signal can be used to capture position once per revolution Each of the four states of the quadrature position signal are decoded by the LM626 629 giving a 4 times increase in position resolution over the number of encoder iines N line encoder will be decoded as 4 position counts by LM628 629 Position decoder block diagram Figure 4 shows three lines coming from the shaft encoder M1 M2 and Index From these the decoder PLA determines if the motor has moved forward backward or stayed still and then drives a 16 bit up down counter that keeps track of actual mator position Once per revolution when three lines including the index line simultaneously low Figure 3 the current position count is captured an index latch positive dir
138. s By definition average velocity during the acceleration and deceleration periods from and to zero half the maximum velocity this example half the total time to make the move 30 seconds is taken by acceleration and decelera tion Thus in terms of time half the move is made at maxi mum velocity and half the move at an avarage velocity of half this maximum Therefore the combined distance trav eled during acceleration and deceleration is half that during 599 register 32 tits LL 1 6 output gt 12 58 output TL H 11018 19 FIGURE 19 Scaling for k 166 667 COUNTS gt ttt COUNTS f 166 657 COUNTS MAXIMUM VELOCITY EQUAL RATES STOPPING POSITION ACCELERATION 8 AND DECELERATION 15 INTEGRAL TRAPEZOID AND 59 qus EQUALS 500 REVOLUTIONS 1 000 000 COUNTS AVERAGE VELOCITY DURING ACCELERATION AND DECELERATION 1 REVS MIN OR COUNTS SAMPLE EQUALS 1 2 MAXIMUM VELOCITY TIME SECONDS TL H 11018 20 FIGURE 20 Trajectory Calculation Example Protile 20 maximum velocity or 75 of the total or 333 333 counts celeration and deceleration takes 166 667 counts respec tively Tha time interval used by the LM628 629 the sampla interval which is 256 ps for a fci of 8 MHz The number of sample periods in 15 seconds 155 256 us 58 600 samples Remembering that dist
139. s commands to the LM628 via the host I O port when Port Select PS input Pin 16 is logic low The desired command code is applied to the parallel port line and the Write input Pin 15 is strobed The command byte is latched into the LM628 on the rising edge of the WR input When writing command bytes it is neces sary to first read the status byte and check the state of a flag called the busy bit Bit 0 If the busy bit is logic high no command write may take place The busy bit is never high longer than 100 and typically falls within 15 to 25 The host processor reads the LM628 status byte in a similar manner by strobing the Read RD Input Pin 13 when PS Pin 16 is low status information remains valid as long as is tow Writing and reading data to from the LM628 as opposed to writing commands and reading status are done with PS Pin 16 logic high These writes and reads are always an inte gral number from one to seven of two byte words with the first byte of each word being the more significant Each byte requires a write WR or read FID strobe When transferring data words byte pairs it is necessary to first read the status byte and check the state of the busy bit When the Theory of Operation Continued busy bit is logic low the user may then sequentially transfer both bytes comprising amp data word but the busy bit must again be checked and found to be low before attempting to
140. s non specific to any microcontroller pseudo commands WA XXXXH and RD XXXXH with hex im mediate data will be used to indicate read and write opera tions respectively by the host to and from the LM628 629 Decisions use IF THEN ELSE BUSY is a user routine to Check the busy bit in the Status Byte WAIT is a user routine to wait 1 5 ms after hardware reset iRoutine to wait 1 5 ms after reset correct RESET operation by reading the Status Byte This should be either hex 84 C4 IF Status byte hardware RESET not equal hex 84 or C4 THEN repeat iMake decision concerning validity of RESET Optionaily the Reset can be further checked or correct operation as follows It is useful to inctude this to reset all interrupt bits in the Status Byte before further action LM628 629 This mask disables all interrupts Host writes two zero bytes of data to LM628 629 MSKI interrupts BusY Check busy bit 0 routine WR 0000H sHost writes two zero bytes of data to BUSY Check busy bit RSTI Reset Interrupts command BUSY iCheck busy bit WR OOOOH RDSTAT IF Status byte hardware RESET Status Byte Check busy bit BUSY RSTI Interrupts BUSY iCheck busy bit WR OOOOH Reset all interrupt bits Set Output Port Size for a 12 bit DAC PORT BUSY sCheck busy bit PORT12 Status byte should read either hex B0 or CO not equal hex 80 ar CO THEN repeat equal to
141. t trol word Position C0000000 to 3FFFFFFF Hex Velocity 00000000 to 3FFFFFFF Hex Pos Only Acceleration 00000000 to 3FFFFFFF Hex Pos Only Executable During Motion Conditionally See Text TABLE V Derlvative Term Sampling Interval Selectlon Codes Bit Position Selected Derivative 15 34 13 12 Sampling 256 ps 512 ys 768 us 1024 ps etc ooo00 65 536 ps Sampling intervals shown are when using an 8 0 MHz clock The 256 corresponds to 2048 8 MHz sample intervals must be scaled for clock frequencies Po 1959 National Semiconductor Corporation 13 13 Trajectory Control Commands continues The trajectory control parameters which are written to the LM828 to control motion acceleration velocity and po sition addition indications as 10 whether these three rameters to be considered as absolute or relative inputs selection of velocity mode and direction and manual stop ping mode selaction and execution are programmable via this command After writing command code tha first two data bytes that are written specify which parameter s is are being changed The firet byte written is the more significant Thus the two data bytes constitute a trajectory control word that informs the LM628 as to the nature and number of any following data bytes See Table VI TABLE Vi Trajeciory Control Word Bit Al
142. t 5 the excessive position error interrupt flag is set ta logic one when position error interrupt condition exists This occurs when the error threshold loaded via command LPES has been exceeded The flag is functional independent of the host interrupt mask status Bit 5 is cleared via command RSTI Bit 4 the wraparound interrupt flag is set to logic one when numerical wraparound has occurred To wraparound means to exceed the position address space of the 1 628 which could occur during velocity mode operation If a wrap around has occurred then position information will be in error and this interrupt helps the user to ensure position data integrity The fag is functional independent of the host interrupt mask status Bit 4 is cleared via command RSTI Bit 3 the index pulse acquired interrupt flag is set to logic one when an index pulse has occurred if command SIP had been executed and indicates that the index position regis ter has been updated The flag is functional independent of the host interrupt mask status Bit 3 is cleared by command RSTI 91989 Semiconductor Corporation Bit 2 the trajectory complete interrupt flag is eet to logic when the trajectory programmed by the LTRJ com mand and initiated by the STT command has been complet ed Because of overshoot or a limiting condition such as commanding the velocity to be higher than the motor can achieve the motor
143. t buffers Busy bit Check Module d 00 HB These two bytes are the d OA LB trajectory contro word hex LB indicates velocity and position will be loaded and both parameters are absolute Busy bit Check Module d xx HB Velocity is loaded in two data xx LB words These two bytes are the high data word Busy bit Check Module d xx HB velocity data word low d xx LB Busy bit Check Module d Position is loaded in two data d LB words These two bytes are the high data word Busy bit Check Module d HB position data word low d LB WAIT Busy bit Check 01 STT STT must be issued to execute the desired trajectory Busy bit Check FIGURE 7 Trajectory Programming Module STOP MODULE This demonstrates the programming flow required to stop shaft motion While the LM628 operates in position mode normal stop ping is always smooth and occurs automatically at the end of a specified trajectory stop module is required Under exceptional conditions however a stop module can be used to affect a premature stop While the LM628 operates in velocity mode stopping is al ways accomplished via a stop module The example stop module shown in Figure 8 utilizes an LTRJ command sequence and an STT command Load Trajectory Parameters Bits eight through ten of the trajectory control word select the stopping mode See Table V In the case of the examp
144. t occurs with a con stant velocity output and the position error due to a constant static torque value of integration limit il has to be input with ky otherwise k will have no effect The integral coeffi cient k adds another variable to the system to allow further optimization very high values of will decrease the phase margin and hence stability see Section 5 and reference 2 for more details Reference 5 gives more details of PID filter tuning and how to load filter parameters Figure 11 illustrates how relativaly slow response with overshoot can be compensated by adjustment of the PID filter coefficients to give a faster critically damped response 3 0 USER COMMAND SET 3 1 Overview The following types of User Commands are available Initialization Filter control commands Trajectory control commands interrupt control commands Data reporting commands User commands are single bytes and have a varying num ber of accompanying data bytes ranging from zero to four teen depending upon the command Both fitter and trajecto ry control commands double buffered scheme to input data These commands load primary registers with multiple words of data which are only transferred into secondary working registers when the host issues a respective single byte user command This allows data to be input before its amp ctual use which can eliminate any potential communication bottlenecks and allow synchronized operation
145. ted to hexa decimal COUNTS 17 41 000000 11 hex cs COUNTS 161 087 0002 75 hex e 120 000 FF FE 2B 40 hex COUNTS BASIC VELOCITY MODE MOVE WITH BREAKPOINTS This program demonstrates basic velocity mode program ming and the typical programming flow required to set both absolute and relative breakpoints See Figure 17 Move The shaft will accelerate at 1 0 rev sec until it reaches a maximum velocity of 2 0 rev sec After complet ing twenty forward direction revolutions including revolu tions during acceleration the shaft will accelerate at 1 0 rev sec until it reaches a maximum velocity of 4 0 rev sec After completing twenty forward direction revolutions in cluding revolutions during acceleration the shaft will decel erate at 1 0 rev sec to a stop See Figure 16 11 4 0 Velocity RPS 22 t seconds 16 5 TL H 10860 16 FIGURE 16 Velocity Profile for Basic Velocity Mode with Breakpoints Program Mask Interrupts An MSKI command sequence allows the user to determine which interrupt conditions result in host interrupts interrupt ing the host the host interrupt output pin 17 tt contains an MSKI command and one data word command initiates interrupt masking Immediately following the MSKI command a single data word is written The first byte is not used Bits one through six of the second byte determine the m
146. tems without significant static torque loading a kj of zero may be appropriate The corrective force provided by the integral term increases linearly with time The integration limit coefficient i acts as a clamping value on this force to prevent integral wind up a backlash effect In many systems ij can be set to its maxi mum value 7FFF hex without any adverse effects in tegral term has no effect if 15 set to zero For the test system the final values of kj and ij are 5 and 1000 respectively STEP TWO STEP RESPONSE METHOD Introduction The step response of a control system reveals important information about the quality of control specitically de tailed information on system damping in the second step to tuning the PID filter an oscilloscope trace of the contro system step response is used to accu rately evaluate system damping and the filter coefficients determined in step one are fine tuned to critically damp the system Software Considerations The step generation section of the filter tuning program pro vides the controt loop with a repetitive small signal step in put This is accomplished by repeatedly executing small position move with high maximum velocity and high acceler ation See Flow Diagram 3 and Figure 23 Laad Trajectory Paramelers Stert the step Read the Status Byte Trajectory Complate bit set 2 Reset interrupts TL H 10860 22 Flow Diagram 3 Step G
147. tes data into 1828 629 and similarly RD is brought low to read data from LM628 629 Data transfer is a two byte operation writ ten in most to least significant byte order The above de scription assumes that CS is low INTERNAL OATABUS TUMH 11018 9 FIGURE 9 Host Interface Internal 1 Registers 2 11 Hardware Busy Bit Operation Before and between command byte and data byte pair fransfers the busy bit must be read and checked to be at logic tow If the busy bit is set and commands are issued they will be ignored and if data is read it will be the current contents of the buffer and not the expected data The busy bit is set alter the rising edge of the write signal for commands and the second rising edge of the respective read or write signal for two byte data transfers Figure TO The busy bit remains high tor approximately 15 us This sequence repeated until data bytes ere written 2222 Ite XA bust 15 25 typical TL H 11018 10 FIGURE 10 Busy Bit Operation during Command and Data Write Sequence The busy bit reset to logic low indicates that high and low byte registers shown in Figure 9 have been either loaded read by the 628 629 internal microcode To service the command or data transfer this microcode which performs the trajectory and filter calculations is interrupted except in critical areas and the on going calculation is suspended The mi
148. th Hardware Reset Hote 1 The 804 host port is a dual mode it operates in command data mode Tha logic level at PS pin 16 selects the mode Port gents the LM628 command port commands are written to the command port and the Status Byte is read from the command port logic level of 0 at PS selects the command port Port d represents the 628 data port data is both written to and read from the data port A logic level of 1 at PS selects the data port Note 2 x don t care Note 3 HB high byte LB low byte Note 4 All values reprosented in hex Immediately following the RST command a single data word is written The first byte is not used Logical zeros in bits one through six of the second byte reset the corre sponding interrupts See Table Any combination of the interrupt flag bits can be reset within a single RSTI com mand sequence This feature allows interrupts to be serv iced according to user programmed priority In the case of the example module the second byte of the RSTI data word 00 hex resets interrupt flag bits See Figure 3 TABLE Status Byte Bit Allocation off Position Error Error Observed Interrupt Interrupt Interrupt Breakpoint Wrep eround Trajectory Busy bit Reached Occurred Complete interrupt interrupt TL H 10860 6 TABLE Interrupt Mask Reset Bit Allocations high byte not used TL H 108
149. the current actual position of the motor will typically be a few counts away from the current desired po sition because a new value for desired position is calculated every sample interval during profila generation The diftar ence between the current desired position and current actu position relies on the ability of the control loop to keep the motor on track In the extreme example of a locked rotor there could be a large difference between the current actuat and desired positions Current desired velocity refers to a fixed velocity at any point on a on going trajectory profile While the profile de mands acceleration from zero to the target velocity the velocity will incrementally increase at each sample interval Current actual velocity is determined by taking the differ ence in the actual position at the current and the previous sample intervals At velocities of many counts per sample this is reasonably accurate at iow velocities especially low one count per sampie it is very inaccurate 2 5 Profile Generation Trajectory profiles are plotted in terms of velocity versus time Figure 5 and are velocity profiles by reason that a new desired position is calculated every sample interval For constant velocity these desired position increments will be the same every sample interval for acceleration and decel eration the desired position increments will respectively in crease and decrease per sample interval Target positio
150. tion 0000000 to maximum positive position hex 3FFFFFFF using a 32 hit double word Bit 31 is the direction bit logic 0 indicates forward direction bit 30 is the wraparound bit used to control position over range in valoci ty or position mode When the position increases past hex 3FFFFFFF the wrap around bit 30 is set which also sets the wraparound bit in the Status byte bii 4 This be polled by the host or optionally used to interrupt the host as defined by the MSKI commands Essentially the host has to manage wraparound by noting its occurrence and resetting the Status byte wrap around bit using the RSTI command When the wraparound bit 30 is set in the position register so is the direction bit This means one count past maximum positive position hex 3FFFFFFF moves the position register onto the maxi mum negative position hex CO000000 Continued increase in positive direction causes the position register to count up to zero and back to positive values of position and on toward another wraparound Similarly when traveling in a negative direction using two s complement arithmetic position counts range from hex FFFFFFF 1 decimal to the maximum negative posi tion of hex COO00000 One more negative count causes the position register to change to hex 3FFFFFFF the maxi mum positive position This time the wraparound bit 30 is reset causing the wraparound bit 4 of the status byte to be set Also the direction
151. tion of jumper block W1 for single channel cards and by W1 W 2 for two channel cards As shipped the card does not have an Installation 9 interrupt line selected The pins in jumper blocks W1 W2 not jumpered for an interrupt The following table lists the jumper configurations and corresponding interrupt request lines Please note that each channel requires its own interrupt line If you are using two channels you must configure each jumper block for a different line Connect appropriate pins with push on connectors J umper W1 corresponds to channel 1 connector 1 J umper W2 corresponds to channel 2 connector J 2 Interrupt Lines W1 amp W2 Pins umpered 11 12 1802 Interrupt Request Line 9 10 IRQ3 7 8 IRQ4 5 6 IRQ5 3 4 IRQ6 1 2 IRQ7 10 11 Nointerrupt line selected NOTE ThelRQ number is marked next to each jumper position on the card Connecting External Equipment WARNING During hardware installation DO NOT apply motor drive amplifier power and DO NOT load the motor shaft with anything that could be damaged or cause personal injury when the motor is later operated Installation 10 Connector J 1 J 2 if you are using two channel card provides the connection for the motor drive signal outputs and the encoder inputs Refer to Appendix A for J 1 and J 2 connector pinouts Use a CMA 14 cable to connect J 1 to the motor amplifier and enco
152. tive term sampling 7 Not Used interval kp ki kd and or il may be changed by the appro 6 Not Used priate command s but command UDF must be executed to 5 Not Used affect the change in filter tuning Filter updating is synchro nized with calculations to eliminate erratic or spurious 4 Not Used behavior 3 Loading kp Data 2 Loading ki Data Trajectory Control Commands 1 Loading kd Data The following two LM628 user commands are used for 0 Loading il Data setting the trajectory control parameters position velocity Bits 6 through 15 select the derivative term sampling inter acceleration mode operation position or velocity and val See Table V The user must locally save and restore direction velocity mode only as required to desoribe a de these bits during successive writes of the filter control word sired motion to select the mode of a manually directed stop and to control the timing of these system changes Bits 4 through 7 of the filter control word are not used LTRJ COMMAND Load TRaJectory Parameters Bits 0 to 3 inform the 628 as to whether any or of the filter parameters are about to be written The usar may Command Code 1F Hex choose to update any or all or of the filter Data Bytes Two to Fourteen ters Those chosen for updating so indicated by logic Data Ranges in the corresponding bit position s of the filter Trajectory Control Word See Tex
153. to apply zaro drive to the motor bit 9 is set to one to stop the motor abruptly at maximum available acceleration by setting the target position equal to the cur rent position and bit 10 is set to one to stop the motor smoothly by using the current user programmed accelera tion value Bits 8 through 10 are to be used exclusively only one bit should be a logic one at any time Bits 0 through 5 inform the LM628 as to whether any or of the trajectory controlling parameters are about to be writ ten and whether the data should be interpreted as absolute or relativo The user may choose to update any or all or nona of the trajectory parameters Those chosen for updat ing are indicated by logic one s in the corresponding bit position s parameter may be changed while the motor is in motion however if acceleration is changed then the naxt STT command must not be issued until the LM628 has completed the current move or has bean manuaily stopped The data bytes specified by and immediately folowing the trajectory control word are written in pairs which comprise 16 bit words Each data item parameter requires two 18 bit words the word and byte order is most to least significant The order of sending the parameters to the LM626 corre sponds to the descending order shown in the above de scription of the trajectory control word i e beginning with acceleration then velocity and finally position Acceleration and velocit
154. top in position mode This is unnec essary in position mode the trajectory stops automatically at the target position see Section 3 3 6 1 2 Can acceteration be changed on the Answer No not directly and a command error interrupt will generated when STT is issued if acceleration has been changed Acceleration can be changed if the motor is turned off first using bit 8 of the Load Trajectory Parameter LTRJ trajectory control word see Section 4 6 1 6 2 More on Acceleration Change 6 2 1 What happens at restart if acceleration is changed with the motor drive off and the motor is still moving Answer The trajectory generation starting position is the actual position when the STT command is issued but as sumes that the motor is statjonary If the motor is moving the control will attempt to bring the motor back onto accelerating profile producing a large error value and less than predictable results The LM628 629 was not designed with the intention to allow acceleration changes with moving motors 6 2 2 1s there any way to change acceleration Answer Acceleration change can be simulated by making many small changes of maximum velocity For instance if small velocity change is loaded using STT com mands issuing these repeatedly at predetermined time in tervals will cause tha maximum velocity to increment pro ducing a piecewise linear acceleration profile The actual acceleration between
155. ually damages bus driver chips and they may become hot when the power is applied This is one of the most common failures of expansion cards Using desktop PC power supplies Occasionally a cus tomer will use a regular desktop PC power supply when bringing up a system Most of these are rated at 5V at 20A or more Switching supplies usually require a 20 load to operate properly This means 4A or more Since typical Micro PC system takes less than 2A the supply does not regulate properly Customers have reported that the output can drift up to 7V and or with 7 8V voltage spikes Unless a scope is connected you may not see these transients Terminated backplanes Some customers try to use Micro PC cards in backplanes that have resistor capacitor termina tion networks CMOS cards cannot be used with termination networks Generally the cards will function erratically or the bus drivers may fail due to excessive output currents Excessive signal lead lengths Another source of failure that was identified years ago at Octagon was excessive lead lengths on digital inputs Long leads act as an antenna to pick up noise They can also act as unterminated transmission lines When 5V is switch onto a line it creates a transient waveform Octagon has seen submicrosecond pulses of 8V or more The solution is to place a capacitor for example 0 1 uF across the switch contact This will also eliminate radio frequency and other high frequency pick
156. unti it stops Low values of acceleration and velocity can now be input of around 100 and a position move com manded to say 1000 counts All values suggested here are decimal For details of loading trajectory and filter parama ters see Section 3 0 reference 5 and the data sheet it is useful at this stage to try different values of acceleration and velocity to get a feel for the system limitations These be determined by using the reporting commands of de sired and actual position and velocity to see if the error between desired and actual positions of the motor are con stant and not increasing without bound Sea Section 3 6 and the data sheet for information about the reporting com mands Clearly it wil be difficult tune for best system response if the motor and its load cannot achieve the de manded values of acceleration and velocity When correct operation is confirmed and limiting values understood fitter tuning can commence Due to the basic difficulty of accurately modeling a control system with the added problem of variations that can occur in mechanical components over time and temperature it is always necessary at some stage to perform tuning empiri cally Determining the PID filter coefficients by tuning is the preferred method with LM626 629 because of the inherent flexibility in changing the filter coefficients provided by this programmabile device tuning a contral system the
157. uonductorCorpomtion Owall Time per State Index Pulse Setup and Hold 13 Relative to A and B Low CLOCK AND RESET TIMING See Figure 3 Clock Pulse Width LM628N 6 or LM629N 6 T4 LM628N 8 or LMG29N 8 4 Clock Period LM628N 6 or LM629N 6 TS LM628N 8 or LM629N 8 15 Reset Pulse Width T6 Min 78 57 166 125 Tested Limlis Units Max BS ns ns ns ns ns Timing Interval Chip Select Setup Hold Time Port Select Setup Time Port Select Hold Time Read Data Access Time Read Data Hold Time RD High to Hi Z Time Chip Select Setup Hold Time Port Select Setup Time Port Selact Hold Time WR Putse Width STATUS BYTE READ TIMING See Figure 4 AC Electrical Characteristics Continued Vpp and Ta per Operating Ratings 6 MHz 50 pF Input Test Signal t 105 Write Data Setup Time Write Data Time the device beyond the above Operating Ratings 1988 National Semiconductor Compomtion DATA WORD READ TIMING See Figure w J o Port Select Setup Time Port Select Hold Time 30 Read Data Access Time Tio Read Data Hold Time TM __ FID High to Hi Z Time Busy BL Del m Read Recovery Time Ti 120 DATA WORD WRITE TIMING See Figure 7 Chip Select Setup Hold Time T Port Select Setup Time Port Select Hold Time
158. up Using CMOS Circuitry 4 TABLE of CONTENTS PREFACE 1 Conventions Used In This Manual sene 1 Symbols and sisii iiinis iana aeiia 2 Pechinical 50 n e ete dde 3 CHAPTER 1 nnn 5 FLOW nne REPRE ORPHEO DER 6 Major niti s e e 6 CHAPTER 2 INSTALLATION 7 EQUIPMOCNE siete 8 ha OR 9 Base AGO nine aetna aa 9 interrupt Request LINCS eee e nets 9 Connecting External Equipment 0404 10 Installing The Card Into The Card Cage 11 Troubleshooting 12 Power pte i o p edt aae 12 Jumper Configuratio trn rr ar eter ener 13 Technical Assi stae ipiis iaaa 13 CHAPTER 3 LOOP PHASING 15 CHAPTER 4 CALIBRATION 17 APPENDIX A TECHNICAL DATA 19 5328 Specdifications eit cei ecc b idan 19 umper Configurations cert ere ends 20 Connector PINOUT 6 21 APPENDIX LM628 LM629 23 WARRANTY This page intentionally left blank
159. uses serial ports e Other software appropriate for your system e Motor amplifier Encoder e Demonstration program included with your Motion Control Card or available from the Octagon BBS 303 427 5368 Access Indicator mle Control _ Channel 1 Address vs 4 wi Interrupt 15138 s U5 Encoder amp Channel 2 4 EZ Figure 2 1 5328 Component Diagram Installation 8 INSTALLATION Before installing your 5328 become familiar with the location of various connectors and jumpers Refer to Figure 2 1 Base Address J umper block W3 defines the base address As shipped the base address is 100H which is jumper configuration W3 1 2 3 4 5 6 If there is another card in your system with a base address of 100H you must use a different base address for your Motion Control Card or the other card To change the base address change the jumper connections in block W3 Connec the appropriate pins with push on connectors The following table lists the jumper connections and corresponding base addresses Base Address Select W3 Pins J umpered Base Address 1 2 3 41 5 6 100H 3 4 5 6 110H 1 2 5 6 120H 5 6 130H 2134 140H 3 4 150H 1 2 160H Not jumpered 170H default Interrupt Request Lines Which interrupt line you use if any is determined by the configu ra
160. using or LFIL to working registers using the STT or UDF commands Interrupt bits 1 2 and 4 of the Status Byte not set by executing interrupt commands but by events occurring dur ing 1 628 629 operation as follows Bit 1 is the command error interrupt bit 2 is the trajectory complete interrupt and bit 4 is the wraparound interrupt These bits are also masked and reset by the MSKI and RSTI commands re spectively The Status still indicates the condition of interrupt bits 1 6 when they are masked from interrupting the host allowing them to be incorporated in a polling scheme 3 6 Data Reporting Commands Read Status Byte ROSTAT supported by a hardware regis ter accessed via CS AD and PS control is the most fre quently used method of determining LM628 629 status This is primarily to read the busy bit 0 while communicating commands and data as described in Section 3 2 There are seven other user commands which can read data from LM628 629 data registers The Read Signals Register command RDSIGS returns 16 bit data word to the host The least significant byte re peats the ROSTAT byte except for bit 0 which indicates that 51 command has been executed but that an index pulse has not occurred The most significant byte has 6 bits that indicate set up conditions bits 8 9 11 12 13 and 14 The other two bits of the RDSIGS data word indicate that the trajectory generator has completed its
161. utput and Position Encoder interfaces 0800 38 14 FIGURE 14 LM628 Example of Linear Motor Drive Using LM12 5v MOTOR 118293 LM629 TL H 11018 15 FIGURE 15 LM629 H Bridge Motor Drive Example Using LM18293 16 4 3 Software Making LM828 629 perform motion contro function ro that the host microcontroller after initializing 1 628 629 loads coefficients for the PID fter and then loads trajectory information The interrupt and data report ing commands can then be used by the host to keep track of LM628 629 actions For detailed descriptions see the 1 628 629 data sheet and Section 3 4 4 Initlalization There is only one initialization operation that must be per formed a chack that hardware resat has operated correctly if required the size of the LM628 output port should be contigured Other operations which might be part of user s systom initialization are discussed under interrupt and Data Reporting commands Sections 3 5 and 3 6 4 4 1 Hardware RESET Check The hardware raset is activated by logic low pulse at pin 27 RST from the host of greater than 8 clock cycles To ensure that this reset has operated correctly the Status Byte should be checked immediately after the reset pin goes high it should read hex 00 If the reset is successful this will change to hex 84 or C4 within 1 5 ms if not the hard ware reset and check should be repeate
162. velocity increments remains the same 6 3 More on Stop Commands 6 3 1 What happens the on going trajectory 18 stopped by setting LTRJ control word bits 9 or 10 stop abruptly or stop amocthly and then restarted by issu ing Start STT Answer While stopped the motor position will be held by the control loop at the position determined as a result of issuing the stop command issuing STT will cause the motor to restart the trajectory toward the original target position with normal controlled acceleration 6 3 2 What happens if the on going trajectory is stopped by setting control word bit 8 motor off Answer The M628 s DAC output is set to mid scale this puts zero volts on the motor which will still have a dynamic braking effect due to the commutation diodes The LM629 s PWM output sets the magnitude output to zero with a similar effect If the motor freewheeis is moved the desired and actual positions will be the same This can be verificd using the RODP and RDRP commands When Start STT is is sued the loop will be closed again and the motor will move toward the original trajectory from the actual current posi tion 6 3 3 If the motor is off how can the control loop be closed and the motor energized Answer Simply by issuing the Start STT command If any previous trajectory has completed then the motor will be held in the current position If a trajectory was in progress when the motor off command was issued the
163. w the step position parameter must not be set higher than 200 counts Note 3 The circuit of Figure 24 produces an inverted stop response graph The oscilloscope input was inverted to produce a positive going more familiar step response graph Figure 25 represents the step response of an under damped control system this response exhibits excessive overshoot and long settling time The fitter parameters used to gener ate this response were as follows kp 35 5 600 ds 4 i 1000 Figure 25 indicates the need to increase the differential gain coefficient Figure 26 represents the step response of an over damped control system this response exhibits excessive rise time which indicates a sluggish system The filter parameters used to generate this response were as follows Ko 35 kj 5 kg 10 000 ds 7 1000 Figure 26 indicates the need to decrease and dg Figure 27 represents the step response of a critically damped control system this response exhibits virtually zero overshoot and short rise time The filter parameters used to generate this response were as follows kp 40 5 4000 ds 4 i 1000 12 4 99 oscilloscope input TL H 10860 23 FIGURE 24 Circuit for Viewing the System Step Response with an Oscilloscope 19 LM628 Programming Guide AN 693 Lit 100693 5V div 100 mSEC div Trigger Signal Step Response TL HZ1086
164. when properly used in accordance support device or system or to affect its safety or with instructions for use provided in the labeling can effectiveness be reasonably expected to result in a significant injury 52006 does not any responebi use sey described Circuit pele are implied and Halona reserves the ight at any without to change said and spectications 1089 National Semiconductor Corporation to the user National Semiconductor Semiconductor KS Japan LM Waikonal Semiconiiuctor ational Semicondutorer Wetiongi Semiconductor Corporation Sameio Bids SF Hong Kong LM Do Brest Lice Australia PTY 16 2900 Semiconductor Drive Westenderssse 153 105 4 16 Asis ng 830 21 3 High 58000 04000 Munchen 21 Shinibk Ku Ausin Tower 4th Floor B Bayswater Victories 3153 Sante Clore 05052 58090 West Germany Tokyo 190 Jepen 22 264 Ausin Avenue 01452 Sao Paulo Brasi Ausrala Tei 406 721 5000 Tal 080 5709501 Tel 3 299 7001 Kowloon Tet 65 11 212 5066 03 729 6332 910 330 9240 Telex 522712 3 299 2000 Tek 3722120 37242645 Telex 201 1131931 NSBR Telex 2006 LM628 629 User Guide 1 0 INTRODUCTION 1 1 Application Note Object
165. xecution of the de sired trajectory With the acceleration set at zero the profile generator generates a desired shaft position that is both constant and equal to the current absolute position See Figure 5 Under these conditions the contro system will attempt to hold the shaft at its current absolute postion The shaft will feel lightly spring loaded forced CAREFUL LY away from its desired position and released the shaft will spring back to the desired position if the polarity of the motor drive signal is incorrect loop inversion motor runaway will occur immediately after exe of command STT or after the shaft is forced CARE FULLY from its resting position Loop inversion can be corrected with one of three methods interchanging the shaft position encoder signals channel A and channel B interchanging the motor power leads or inverting the motor command signal before application to the motor drive amplifier For LM629 based systems loop inversion can be corrected by interchanging the motor pow er leads interchanging the shaft position encoder signals logically inverting the PWM sign signal SIMPLE ABSOLUTE POSITION MOVE The Simple Absolute Position Move Program detailed in Figure 13 utilizes both the initialization and filter program ming modules as well as an LTRJ command sequence and an STT command Factors that influenced the development of this program in cluded the following the progra
166. y are 32 bits positive only but tange only from 0 00000000 hex to 299 1 3FFFFFFF hex The bottom 16 bits of both accelaration and velocity are scaled fractional data therefore the least significant integer data bit for these parameters is bit 16 where the bits are numbered 0 through 31 To determine the coding for a given velocity for example multiplies the desired veloc ity in counts per sample interval times 65 536 and converts the result to binary The units of acceleration are counts per sample per sample The value loaded for acceleration must not exceed the value ioaded for velocity Position is amp Signed 32bit integer but ranges oniy from 230 C0000000 hex to 230 1 3FFFFFFF Hex The required data is written to the primary buffers of a dou ble buffered scheme by the above described oparations it is not transferred to the secondary working registers until the STT command is executed This fact can be used ad vantageously the user can input numerous data shead of their actual use This simple pipeline effect can relieve po tential host computer data communications bottlenecks and facilitates easier synchronization of multipie axis trois Before using LTRJ to issue a new acceleration value motor off command must first be executed com mand with bit 8 of the Trajectory Contro Word set This procedure is only necessary if the acceleration value is be ing changed
167. zoidal velocity profile and a digital compensation filter The DAC output of the 5328 interfaces to a digital to analog converter to produce the signal that is power amplified and applied to the motor An incremental encoder provides feedback for closing the position servo loop The trapezoidal velocity generator calculates the required trajectory for either position or velocity mode of operation During operation the 5328 subtracts the actual position from the desired position The resulting position error is processed by the digital filter to drive the motor to the desired position For more information on the theory of operation please refer to Appendix B MAJOR FEATURES The 5328 Motion Control Expansion Card exhibits the following features accepts position signals from a quadrature encoder has a selectable base address works with any Micro PC control card is available with one or two channels for one or two axis control has programmable digital PID filter with 16 bit coefficients has programmable derivative sampling interval has 32 bit position velocity and acceleration registers has internal trapezoidal velocity profile generator has position and velocity modes includes a quadrature encoder interface with differential or single ended inputs e parameters be changed on the fly during motion e has 341 S sampling interval e provides 12 bit DAC output Overview 6 2 INST
Download Pdf Manuals
Related Search
Related Contents
MEGASTAR MANUALE ITA.cdr スライドハンマプラー(AUD3・4・5)取扱説明書 Preguntas frecuentes OM, RVL200, RVL300, Husqvarna, FR, 2007-11 設置説明書 - 日立の家電品 Bullard POWERHOUSETM Charging Station Free RT-3000 - Pro Gun Chop Trigger Manual Manuel d`utilisation FANCY_STYLE_2500 DS623_180x236 Copyright © All rights reserved.
Failed to retrieve file