| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
LM628 Programming Guide National Semiconductor Application Note S
Top Searches for this datasheetLM628 Programming Guide LM628 Programming Guide National Semiconductor Application Note Steven Hunt April 1991 REFERENCE SYSTEM Figure detailed schematic closed-loop motor control system programs presented this paper were developed using this system application programs other LM628-based systems changes basic programming structure required modification filter coefficients trajectory parameters required PROGRAM MODULES Breaking programs LM628 into sets functional blocks simplifies programming process each block executes specific task This section contains examples principal building blocks (modules) programs LM628 INTRODUCTION LM628 LM629 dedicated motion control processors Both devices control brushless servo motors well other servomechanisms that provide quadrature incremental feedback signal Block diagrams typical LM628 LM629-based motor control systems shown Figures indicated figures LM628 LM629 peripherals both devices must programmed host processor This application note intended present concrete starting point programmers these precision motion controllers focuses development short programs that test overall system functionality groundwork more complex programs also presents method tuning loop-compensation filter 10860 FIGURE LM628-Based Motor Control System AN-693 10860 FIGURE LM629-Based Motor Control System Note remainder this paper statements about LM628 also apply LM629 unless otherwise noted C1995 National Semiconductor Corporation 10860 RRD-B30M75 Printed BUSY-BIT CHECK MODULE first module required successful programming LM628 busy-bit check module busy-bit zero status byte immediately after host writes command byte reads writes second byte data word Table While busy-bit LM628 will ignore commands attempts transfer data busy-bit check module that polls Status Byte waits until busy-bit reset will ensure successful host LM628 communications must inserted after command write read write second byte data word Flow diagram represents such busy-bit check module This module will used throughout subsequent modules programs Reading Status Byte accomplished executing RDSTAT command RDSTAT directly supported LM628 hardware executed pulling logic Flow Diagram Busy-bit Check Module trajectory parameters trajectory parameters input buffers zero current absolute position shaft zero (``home'') breakpoint interrupt masked (disabled) remaining five interrupts unmasked (enabled) position error threshold maximum value 7FFF output port 8-bit interface Flow diagram illustrates hardware reset block that includes LM628 functionality test This test should completed immediately following hardware resets Flow Diagram Hardware Reset Block 10860-3 INITIALIZATION MODULE general initialization module contains reset command other initialization interrupt control data reporting commands example initialization module detailed Figure contains hardware reset block PORT command Hardware Reset Block Immediately following power-up hardware reset must executed Hardware reset initiated strobing (pin logic minimum eight LM628 clock periods reset routine begins after returned logic high During reset execution time maximum LM628 will ignore commands attempts transfer data hardware reset forces LM628 into state described what follows derivative sampling coefficient other filter coefficients filter coefficient input buffers zero With derivative sampling interval 2048 fCLK 10860 Reset Interrupts RSTI command sequence allows user reset interrupt flag bits bits through status byte Table contains RSTI command data word RSTI command initiates resetting interrupt flag bits Command RSTI also resets host interrupt output (pin Port Bytes Command Comments Note don't care Note high byte byte Note values represented (Note hardware Strobe logic eight clock periods reset minimum maximum time complete hardware reset tasks During this reset execution time LM628 will ignore commands attempts transfer data RDSTAT This command reads status byte directly (Note (Note supported LM628 hardware executed time pulling logic Status information remains valid long logic decision status byte continue Otherwise loop back hardware reset This command resets only interrupts indicated zeros bits through next data word also resets fifteen Signals Register host interrupt output (pin wait Immediately following RSTI command single data word written first byte used Logical zeros bits through second byte reset corresponding interrupts Table combination interrupt flag bits reset within single RSTI command sequence This feature allows interrupts serviced according user-programmed priority case example module second byte RSTI data word resets interrupt flag bits Figure TABLE Status Byte Allocation 10860 RSTI TABLE Interrupt Mask Reset Allocations high byte Busy-bit Check Module don't care (Note Zeros bits through indicate interrupts will reset Busy-bit Check Module 10860 byte RDSTAT This command reads status byte decision status byte continue Otherwise loop back hardware reset reset default size port eight bits This command initializes port 12-bit should issued systems with 8-bit PORT12 10860 Busy-bit Check Module FIGURE Initialization Module (with Hardware Reset) Note 8-bit host port dual-mode port operates command data mode logic level (pin selects mode Port represents LM628 command port-commands written command port Status Byte read from command port logic level ``0'' selects command port Port represents LM628 data port data both written read from data port logic level ``1'' selects data port Port Size During both hardware software resets output port defaults 8-bit mode LM628 control loop utilizes 12-bit command PORT12 should issued immediately following hardware reset block subsequent resets Failure issue command PORT12 will result erratic unpredictable motor behavior control loop utilizes 8-bit command PORT12 must executed this will result erratic unpredictable motor behavior LM629 will ignore command PORT8 provides 8-bit sign magnitude output) Command PORT12 should issued LM629-based systems Software Reset Considerations After initial hardware reset resets accomplished with either hardware reset command RESET (software reset) Software hardware resets execute same tasks require same execution time maximum During software reset execution LM628 will ignore commands attempts transfer data hardware reset module includes LM628 functionality test This test required after software reset Figure details initialization module that uses software reset case software reset position error threshold remains pre-reset value After executing example initialization module following observations made With integration limit term (iL) filter gain coefficients initialized zero filter gain zero Moreover after reset desired shaft position tracks actual shaft position Under these conditions motor drive signal zero control system affect shaft position shaft should stationary ``free wheeling'' there significant drive amplifier offset shaft rotate slowly with minimal torque capability Note Regardless free wheeling state shaft LM628 continuously tracks shaft absolute position Port Bytes Command RESET wait Comments Initialization Module text maximum time complete RESET tasks RESET default size port eight bits This command initializes port 12-bit should issued system with 8-bit FILTER PROGRAMMING MODULE example filter programming module shown Figure Load Filter Parameters (Coefficients) LFIL (Load FILter) command sequence includes command LFIL filter control word variable number data words LFIL command initiates loading filter coefficients into input buffers data bytes written immediately after LFIL comprise filter control word first byte programs derivative sampling coefficient selects derivative sampling interval) second byte indicates with logical ones respective positions which remaining four filter coefficients will loaded Tables combination four coefficients loaded within single LFIL command sequence Immediately following filter control word filter coefficients written Each coefficient written pair data bytes data word Because combination four coefficients loaded within single LFIL command sequence number data words following filter control word vary range from zero four case example module first byte filter control word programs derivative sampling coefficient second byte indicates only proportional gain coefficient will loaded Immediately following filter control word proportional gain coefficent written this example with data word 000A other three filter coefficients remain zero their reset value Update Filter update filter command transfers filter coefficients from input buffers working registers Until executed filter coefficients affect transfer characteristic filter PORT12 Busy-bit Check Module RSTI This command resets only interrupts indicated zeros bits through next data word also resets fifteen Signals Register (pin host interrupt output Busy-bit Check Module Don't care Zeros bits through indicate interrupts will reset Busy-bit Check Module FIGURE Initialization Module (with Software Reset) Comments Figure illustrates simplified block diagram form LM628 profile generator provides control loop input desired shaft position quadrature decoder provides control loop feedback signal actual shaft position first summing junction actual position subtracted from desired position generate control loop error signal position error This error signal filtered filter provide motor drive signal 10860 FIGURE LM628 Simplified Block Diagram Form TABLE Filter Control Word Allocation 10860 TABLE Derivative Term Sampling Interval Selection Codes Selected Derivative-Term Sampling Interval Filter Control Word Position (2048) 256Ts System Sample Period Derivative-term Sampling Interval Port Bytes Command LFIL Comments This command initiates loading filter coefficients input buffers Busy-bit Check Module These bytes filter control word sets derivative sampling interval 2048 fCLK setting indicates only will loaded other filter parameters will remain zero their reset default value Busy-bit Check Module These bytes Busy-bit Check Module This command transfers filter coefficients from input buffers working registers Until executed coefficients loaded LFIL command affect filter transfer characteristic Busy-bit Check Module data bytes written immediately after LTRJ comprise trajectory control word first byte programs with logical ones respective positions trajectory mode (velocity position) velocity mode direction stopping mode Stop Module second byte indicates with logical ones respective positions which three trajectory parameters will loaded also indicates whether parameters absolute relative Table combination three parameters loaded within single LTRJ command sequence Immediately following trajectory control word trajectory parameters written Each parameter written pair data words (four data bytes) Because combination three parameters loaded within single LTRJ command sequence number data words following trajectory control word vary range from zero case example module first byte trajectory control word programs LM628 operate position mode second byte indicates velocity position will loaded both parameters absolute Four data words each parameter loaded follow trajectory control word Start Motion Control start motion control command (STarT) transfers trajectory parameters from input buffers working registers begins execution trajectory Until executed trajectory parameters affect shaft motion Note this point actual trajectory parameters loaded Calculation trajectory parameters execution example moves left later section FIGURE Filter Programming Module Comments After executing both example initialization example filter programming modules following observations made Filter gain nonzero desired shaft position continues track actual shaft position Under these conditions motor drive signal remains zero shaft should stationary ``free wheeling'' there significant drive amplifier offset shaft rotate slowly with minimal torque capability Initially should below twenty should should remain zero These values will provide optimum system performance they will sufficient test system functionality Tuning Filter TRAJECTORY PROGRAMMING MODULE Figure details example trajectory programming module Load Trajectory Parameters LTRJ (Load TRaJectory) command sequence includes command LTRJ trajectory control word variable number data words LTRJ command initiates loading trajectory parameters into input buffers Table Trajectory Control Word Allocation high byte 10860 byte 10860 Port Bytes Command LTRJ Comments This command initiates loading trajectory parameters input buffers Setting trajectory control word selects stop smoothly desired stopping mode This mode stops shaft motion decelerating current user-programmed acceleration rate Note Bits eight through trajectory control word must used exclusively only them should logic time Busy-bit Check Module These bytes trajectory control word indicates velocity position will loaded both parameters absolute Busy-bit Check Module Velocity loaded data words These bytes high data word Busy-bit Check Module velocity data word (low) Busy-bit Check Module Position loaded data words These bytes high data word Busy-bit Check Module position data word (low) Busy-bit Check Module must issued execute desired trajectory Busy-bit Check Module Start Motion Control start motion control command must executed stop shaft motion Comments After shaft motion stopped with either ``abrupt'' ``smooth'' stop module control system will attempt hold shaft current position forced away from this desired resting position released shaft will move back desired position Unless trajectory parameters loaded execution another command will restart specified move After shaft motion stopped with ```motor-off'' stop module desired shaft position tracks actual shaft position Consequently motor drive signal remains zero control system affect shaft position shaft should stationary free wheeling there significant drive amplifier offset shaft rotate slowly with minimal torque capability Unless trajectory parameters loaded execution another command will restart specified move Port Bytes Command LTRJ Comments This command initiates loading trajectory parameters input buffers FIGURE Trajectory Programming Module STOP MODULE This module demonstrates programming flow required stop shaft motion While LM628 operates position mode normal stopping always smooth occurs automatically specified trajectory stop module required) Under exceptional conditions however stop module used affect premature stop While LM628 operates velocity mode stopping always accomplished stop module example stop module shown Figure utilizes LTRJ command sequence command Load Trajectory Parameters Bits eight through trajectory control word select stopping mode Table case example module first byte trajectory control word selects motor-off desired stopping mode This mode stops shaft motion setting motor drive signal zero (the appropriate offset-binary code apply zero drive motor) Setting nine trajectory control word selects stop abruptly desired stopping mode This mode stops shaft motion maximum deceleration) setting target position equal current position Busy-bit Check Module These bytes trajectory control word selects motor-off desired stopping mode indicates trajectory parameters will loaded Busy-bit Check Module start motion control command must executed stop shaft motion Busy-bit Check Module FIGURE Stop Module (Motor-Off) PROGRAMS This section focuses development four brief LM628 programs LOOP PHASING PROGRAM Following initial power-up correct polarity motor drive signal must determined polarity incorrect (loop inversion) drive signal will push shaft away from desired position rather than towards This results ``motor runaway'' condition characterized motor running continuously high speed loop phasing program detailed Figure contains both example initialization filter programming modules also contains LTRJ command sequence command Note Execution this simple program only required first time system used polarity motor drive signal incorrect (loop inversion) motor runaway will occur immediately after execution command after shaft forced (CAREFULLY) from resting position Loop inversion corrected with three methods interchanging shaft position encoder signals (channel channel interchanging motor power leads inverting motor command signal before application motor drive amplifier LM629 based systems loop inversion corrected interchanging motor power leads interchanging shaft position encoder signals logically inverting sign signal SIMPLE ABSOLUTE POSITION MOVE Simple Absolute Position Move Program detailed Figure utilizes both initialization filter programming modules well LTRJ command sequence command Factors that influenced development this program included following program must demonstrate simple trajectory parameters calculations program must demonstrate programming flow required load execute absolute position move correct completion move must verifiable through simple observation Move shaft will accelerate sec2 until reaches maximum velocity then decelerate stop exactly revolutions from starting position Figure Note Absolute position position measured relative zero (home) absolute position move move that ends specified absolute position example independent current absolute position shaft absolute position counts specified upon completion move absolute position shaft will counts counts relative zero) example program calls position move revolutions Because starting absolute position counts move accomplished specifying absolute position 8000 counts Figure Load Trajectory Parameters LTRJ (Load TRaJectory) command sequence includes command LTRJ trajectory control word variable number data words case Loop Phasing Program first byte trajectory control word programs LM628 operate position mode second byte indicates trajectory parameters will loaded this program zero data words follow trajectory control word) three trajectory parameters will remain zero their reset value Start Motion Control start motion control command (STarT) transfers trajectory parameters from input buffers working registers begins execution trajectory Until executed trajectory parameters affect shaft motion Port Bytes Command Comments Initialization Module Filter Programming Module LTRJ This command initiates loading trajectory parameters input buffers Busy-bit Check Module These bytes trajectory control word indicates trajectory parameters will loaded Busy-bit Check Module must issued execute desired trajectory Quadrature Incremental Encoder supplement trajectory parameters calculations brief discussion provided here differentiate between encoder lines encoder counts quadrature incremental shaft encoder encodes shaft rotation electrical pulses Figure details signals generated 3-channel quadrature incremental encoder LM628 decodes ``counts'') quadrature incremental signal determine absolute position shaft FIGURE Loop Phasing Program Comments Execution command results execution desired trajectory With acceleration zero profile generator generates desired shaft position that both constant equal current absolute position Figure Under these conditions control system will attempt hold shaft current absolute postion shaft will feel lightly ``spring loaded'' forced (CAREFULLY) away from desired position released shaft will spring back desired position 10860 FIGURE Velocity Profile Simple Absolute Position Move Program reference system uses thousand line encoder 1000 REVOLUTION CYCLE CYCLES COUNTS 4000 COUNTS REVOLUTION Sample Period Sampling actual shaft position occurs fixed frequency reciprocal which system sample period system sample period unit time upon which shaft acceleration velocity based (2048) CLOCK System Sample Period 10b6 10860 reference system uses clock sample period reference system follows directly from definition (2048) FIGURE 3-Channel Quadrature Encoder Signals resolution quadrature incremental encoder usually specified number lines This number indicates number cycles output signals each complete shaft revolution example N-line encoder generates cycles output signals during each complete shaft revolution definition signals that quadrature phase When considered together channels (Figure traverse four distinct digital states during each full cycle either channel Each state transition represents count shaft motion leading channel indicates direction shaft rotation Each line therefore represents cycle output signals each cycle represents four encoder counts SECONDS SAMPLE Trajectory Parameters Calculations shaft will accelerate sec2 until reaches maximum velocity then decelerate stop exactly revolutions from starting position Trajectory parameters calculations this move detailed Figure Comments After completing move control system will attempt hold shaft current absolute position shaft will feel lightly ``spring loaded'' forced away from desired resting position released shaft will move back desired position REVOLUTION CYCLE CYCLES COUNTS COUNTS REVOLUTION 4000 REVOLUTION COUNTS SAMPLE 536) COUNTS SECONDS SAMPLE REVOLUTIONS SECOND2 COUNTS SAMPLE2 COUNTS SAMPLE2 Acceleration Scaled COUNTS SAMPLE2 Acceleration Rounded COUNTS SAMPLE2 4000 REVOLUTION COUNTS 2048 SAMPLE 536) COUNTS SECONDS SAMPLE REVOLUTIONS SECOND Velocity Scaled 2048 COUNTS SAMPLE COUNTS SAMPLE COUNTS SAMPLE Velocity Rounded COUNTS SAMPLE REVOLUTIONS) 8000 COUNTS 4000 REVOLUTION COUNTS COUNTS FIGURE Calculations Trajectory Parameters Simple Absolute Position Move Port Bytes Command Comments Initialization Module Filter Programming Module LTRJ This command initiates loading trajectory parameters input buffers Busy-bit Check Module These bytes trajectory control word indicates acceleration velocity position will loaded three parameters absolute Busy-bit Check Module Acceleration loaded data words These bytes high data word this case acceleration sec2 Busy-bit Check Module acceleration data word (low) Busy-bit Check Module velocity loaded data words These bytes high data word this case velocity Busy-bit Check Module velocity data word (low) Busy-bit Check Module Position loaded data words These bytes high data word this case position loaded eight thousand counts This results move revolutions forward direction Busy-bit Check Module position data word (low) Busy-bit Check Module must issued execute desired trajectory Note Target position final requested position shaft stationary motion been stopped with ``motor-off'' stop module current absolute position shaft target position motion been stopped with ``motor-off'' stop module position move begun absolute position that corresponds endpoint current trajectory target position Relative position position measured relative current target position shaft relative position move move that ends specified ``relative'' number counts away from current target position shaft example current target position shaft counts relative position counts specified upon completion move absolute position shaft will counts counts relative counts) Load Trajectory Parameters first byte trajectory control word programs position mode operation second byte indicates three trajectory parameters will loaded also indicates both acceleration velocity will absolute values while position will relative value Trajectory Parameters Calculations Independent current resting position shaft shaft will complete thirty revolutions reverse direction Total time complete move fifteen seconds Total time acceleration deceleration five seconds reference system utilizes thousand line encoder number counts each complete shaft revolution total counts this position move determined 1000 REVOLUTION CYCLE 4000 REVOLUTION COUNTS 4000 REVOLUTION REVOLUTIONS) COUNTS CYCLES COUNTS COUNTS With respect time two-thirds move made maximum velocity one-third made velocity equal one-half maximum velocity Therefore total counts traveled during acceleration deceleration periods one-fifth total counts traveled Figure COUNTS COUNTS total counts traveled during acceleration deceleration COUNTS COUNTS counts traveled during acceleration reference system uses clock sample period reference system determined (2048) 106Hz 10b6 SECONDS SAMPLE number samples during acceleration (and deceleration) determined 10b6 SECONDS 9766 SAMPLES number samples during acceleration SECONDS SAMPLE Using number counts traveled during acceleration number samples during acceleration acceleration determined distance traveled during time acceleration FIGURE Simple Absolute Position Move Program SIMPLE RELATIVE POSITION MOVE This program demonstrates programming flow required load execute relative position move Figure Move Independent current resting position shaft shaft will complete thirty revolutions reverse direction Total time complete move fifteen seconds Total time acceleration deceleration five seconds COUNTS) COUNTS 000252 (9766 SAMPLES)2 SAMPLE2 Total counts traveled while maximum velocity four-fifths total counts traveled (120 COUNTS) COUNTS Average velocity during acceleration deceleration periods one-half maximum velocity Port Bytes Command Comments Initialization Module Filter Programming Module LTRJ This command initiates loading trajectory parameters input buffers Busy-bit Check Module These bytes trajectory control word indicates three parameters will loaded both acceleration velocity will absolute values while position will relative value Busy-bit Check Module Acceleration loaded data words These bytes high data word this case acceleration counts sample2 Busy-bit Check Module acceleration data word (low) Busy-bit Check Module Velocity loaded data words These bytes high data word this case velocity counts sample Busy-bit Check Module velocity data word (low) Busy-bit Check Module Position loaded data words These bytes high data word this case position loaded counts This results move thirty revolutions reverse direction Busy-bit Check Module position data word (low) Busy-bit Check Module must issued execute desired trajectory 10860 FIGURE Velocity Profile Simple Relative Position Move Program number samples while maximum velocity determined SECONDS SAMPLES number samples while maximum velocity SECONDS SAMPLE 10b6 Using total counts traveled while maximum velocity number samples while maximum velocity velocity determined COUNTS COUNTS SAMPLES SAMPLE Both acceleration velocity values scaled 000252 SAMPLE 536) SAMPLE COUNTS COUNTS SAMPLE 536) SAMPLE COUNTS COUNTS Acceleration velocity rounded nearest integer three trajectory parameters converted hexadecimal COUNTS SAMPLE2 COUNTS SAMPLE COUNTS BASIC VELOCITY MODE MOVE WITH BREAKPOINTS This program demonstrates basic velocity mode programming (typical) programming flow required both absolute relative breakpoints Figure Move shaft will accelerate sec2 until reaches maximum velocity After completing twenty forward direction revolutions (including revolutions during acceleration) shaft will accelerate sec2 until reaches maximum velocity After completing twenty forward direction revolutions (including revolutions during acceleration) shaft will decelerate sec2) stop Figure FIGURE Simple Relative Position Move Program 10860 FIGURE Velocity Profile Basic Velocity Mode with Breakpoints Program Mask Interrupts MSKI command sequence allows user determine which interrupt conditions result host interrupts interrupting host host interrupt output (pin contains MSKI command data word MSKI command initiates interrupt masking Immediately following MSKI command single data word written first byte used Bits through second byte determine masked unmasked status each interrupt Table zeros this 6-bit field mask (disable) corresponding interrupts while ones unmask (enable) corresponding interrupts case examlple program second byte MSKI data word enables breakpoint interrupt other interrupts disabled (masked) When interrupted host processor read Status Byte determine which interrupt condition(s) occurred Table Note Command MSKI controls only host interrupt process Bits through Status Byte reflect actual conditions independent masked unmasked status individual interrupts This feature allows interrupts serviced with polling scheme example program contains relative breakpoint counts relative position zero (the current target position) This represents move twenty forward direction revolutions When this position reached LM628 interrupts host processor host executes sequence commands that increases maximum velocity resets breakpoint interrupt flag loads absolute breakpoint example program contains absolute breakpoint counts When this absolute position reached LM628 interrupts host processor host executes Smooth Stop Module Breakpoint positions this example program determined 4000 REVOLUTION COUNTS REVOLUTIONS) COUNTS relative breakpoint 4000 REVOLUTION COUNTS REVOLUTIONS) COUNTS absolute breakpoint Breakpoints (Absolute Relative) SBPA command sequence enables user breakpoints terms absolute shaft position SBPR command sequence enables setting breakpoints relative current target position When breakpoint position reached status byte breakpoint interrupt flag logic high this interrupt enabled (unmasked) host will interrupted host interrupt output (pin SBPA SBPR) command initiates loading setting breakpoint data words written immediately following SBPA SBPR) command represent breakpoint position Load Trajectory Parameters This example program contains LTRJ command sequences trajectory control word first LTRJ command sequence 1828 programs forward direction velocity mode indicates absolute acceleration absolute velocity will loaded trajectory control word second LTRJ command sequence 180C programs forward direction velocity mode indicates relative velocity will loaded Table Trajectory parameters calculations follow same format those detailed simple absolute position move Figure Port Bytes Command Comments Port Bytes Command Comments Start motion control Initialization Module Filter Programming Module MSKI Mask interrupts Busy-bit Check Module don't care enables (unmasks) breakpoint interrupt other interrupts disabled (masked) Busy-bit Check Module SPBR This command initiates loading relative breakpoint Busy-bit Check Module breakpoint loaded data words These bytes high data word this case breakpoint counts relative current commanded target position (zero) Busy-bit Check Module breakpoint data word (low) Busy-bit Check Module LTRJ Load trajectory Busy-bit Check Module These bytes trajectory control word programs forward direction velocity mode operation indicates acceleration velocity will loaded both values absolute Busy-bit Check Module Acceleration loaded data words These bytes high data word this case acceleration sec2 Busy-bit Check Module acceleration data word (low) Busy-bit Check Module Velocity loaded data words These bytes high data word this case velocity Busy-bit Check Module LTRJ This command initiates loading trajectory parameters input buffers Busy-bit Check Module These bytes trajectory control word programs forward direction velocity mode operation indicates only velocity will loaded will relative value Busy-bit Check Module Velocity loaded data words These bytes high data word this case velocity Because this relative value current velocity will increased resultant velocity will Busy-bit Check Module velocity data word (low) wait This wait represents host processor waiting LM628 breakpoint interrupt Start motion control Busy-bit Check Module RSTI Reset interrupts Busy-bit Check Module don't care Zeros bits through reset interrupts Busy-bit Check Module SPBA This command initiates loading absolute breakpoint Busy-bit Check Module breakpoint loaded data words These bytes high data word this case breakpoint counts absolute Busy-bit Check Module breakpoint data word (low) wait This wait represents host processor waiting LM628 breakpoint interrupt Busy-bit Check Module velocity data word (low) Busy-bit Check Module ``Smooth'' Stop Module FIGURE Basic Velocity Mode Move with Breakpoints Program 10860 Note resistor values FIGURE Reference System TUNING FILTER BACKGROUND transient response control system reveals important information about ``quality'' control because step input easy generate sufficiently drastic transient response control system often characterized response step input system step response turn step response control system characterized three attributes maximum overshoot rise time settling time These step response attributes defined what follows detailed graphically Figure maximum overshoot maximum peak value response curve measured from unity amount maximum overshoot directly indicates relative stability system rise time time required response rise from ninety percent final value settling time time required response reach stay within percent final value critically damped control system provides optimum performance step response critically damped control system exhibits minimum possible rise time that maintains zero overshoot zero ringing (damped oscillations) Figure illustrates step response critically damped control system ultimate goal tuning filter critically damp motor control system provide optimum tracking settling time shown Figure response filter three terms proportional term integral term derivative term Five variables shape this response These five variables include three gain coefficients integration limit coefficient (il) derivative sampling coefficient (ds) Tuning filter equates determining values these variable coefficients values that critically damp control system Filter coefficients best determined with two-step experimental approach first step values (along with systematically varied until reasonably good response characteristics obtained Manual visual methods used evaluate effect each coefficient system behavior second step oscilloscope trace system step response provides detailed information system damping filter coefficients determined step modified critically damp system Note step adjustments filter coefficient values inherently coarse while step adjustments inherently fine this coarse fine nature steps complement each other two-step approach presented ``best'' tuning method filter tuned with either step step alone STEP MANUAL VISUAL METHOD Introduction first step values (along with systematically varied until reasonably good response characteristics obtained Manual visual methods used evaluate effect each coefficient system behavior Note next four numbered sections ordered steps tuning filter 10860 FIGURE Unit Step Response Curve Showing Transient Response Attributes Prepare System initialization section filter tuning program executed prepare system filter tuning Figure This section initializes system presets filter parameters commands control loop hold shaft current position After executing initialization section filter tuning program both desired actual shaft positions equal zero shaft should stationary displacement shaft constitutes position error with both zero control loop correct this error Determine Derivative Gain Coefficient filter derivative term provides damping eliminate oscillation minimize overshoot ringing stabilize system Damping provided force proportional rate change position error constant proportionality Figure Coefficients determined with iterative process Coefficient systematically increased until shaft begins high frequency oscillations Coefficient then increased entire process repeated until reaches value appropriate system 10860 FIGURE Unit Step Response Critically Damped System INTRODUCTION LM628 digital controller loop-compensation filter controller usually tuned experimentally especially system dynamics well known defined system sample period sets time interval between updates position error derivative sampling interval integer multiple system sample period Table sets time interval between successive position error samples used derivative term therefore directly affects system damping derivative sampling interval should five times smaller than system mechanical time constant this means many systems will require general however should give largest product that maintains acceptably motor vibrations Note Starting doubling good method increasing Manually turning shaft reveals that with each increase resistance shaft turning increases shaft feels increasingly sluggish because provides force proportional rate change position error faster shaft turned more sluggish feels reference system final values 4000 respectively Port Bytes Command RESET wait Comments Initialization Module Text maximum time complete RESET tasks RESET default size port eight bits This command initializes port 12-bit should issued systems with 8-bit PORT12 Proportional Term Busy-bit Check Module RSTI This command resets only interrupts indicated zeros bits through next data word also resets fifteen Signals Register host interrupt (pin Busy-bit Check Module don't care Zeros bits through indicate interrupts will reset 10860-19 Integral Term Busy-bit Check Module MSKI This command masks interrupts indicated zeros bits through next data word Busy-bit Check Module don't care enables (unmasks) trajectory complete interrupt other interrupts disabled (masked) Table Busy-bit Check Module LFIL This command initiates loading filter coefficients input buffers Busy-bit Check Module These bytes filter control word sets derivative sampling interval 2048 fCLK setting indicates only will loaded other filter parameters will remain zero their reset default value Busy-bit Check Module These bytes Busy-bit Check Module 10860-20 Derivative Term 10860 FIGURE Proportional Integral Derivative (PID) Force Components FIGURE Initialization Section Filter Tuning Program (Continued Next Page) Port Bytes Command Comments This command transfers filter coefficients from input buffers working registers Until executed coefficients loaded LFIL command affect filter transfer characteristic Busy-bit Check Module This command initiates loading trajectory parameters input buffers Busy-bit Check Module These bytes trajectory control word indicates trajectory parameters will loaded Busy-bit Check Module must issued execute desired trajectory LTRJ mise between three system characteristics overshoot settling time time cancel effects static torque load systems without significant static torque loading zero appropriate corrective force provided integral term increases linearly with time integration limit coefficient acts clamping value this force prevent integral wind-up backlash effect noted Figure limits summation error (over time) product this summation many systems maximum value 7FFF without adverse effects integral term effect zero test system final values 1000 respectively STEP STEP RESPONSE METHOD FIGURE Initialization Section Filter Tuning Program (Continued) Determine Proportional Gain Coefficient Inertial loading causes following tracking) error position error associated with moving shaft External disturbances torque loading cause displacement error position error associated with stationary shaft filter proportional term provides restoring force minimize these position errors restoring force proportional position error increases linearly position error increases Figure proportional gain coefficient constant proportionality Coefficient determined with iterative process value increased system damping evaluated This repeated until system critically damped System damping evaluated manually Manually turning shaft reveals each increase increases shaft ``stiffness'' shaft feels spring loaded forced away from desired holding position released shaft ``springs'' back system over damped shaft recovers slowly large system under damped shaft recovers quickly This causes overshoot ringing possibly oscillation proportional gain coefficient increased largest value that does cause excessive overshoot ringing this point system critically damped therefore provides optimum tracking settling time Note Starting doubling each iteration good method increasing final value reference system Introduction step response control system reveals important information about ``quality'' control specifically detailed information system damping second step tuning filter oscilloscope trace control system step response used accurately evaluate system damping filter coefficients determined step fine tuned critically damp system Software Considerations step generation section filter tuning program provides control loop with repetitive small-signal step input This accomplished repeatedly executing small position move with high maximum velocity high acceleration Flow Diagram Figure Determine Integral Gain Coefficient filter proportional term minimizes errors inertial torque loading integral term however provides corrective force that eliminate following error while shaft spinning deflection effects static torque load while shaft stationary This corrective force proportional position error increases linearly with time Figure integral gain coefficient constant proportionality High values provide quick torque compensation increase overshoot ringing general should smallest value that provides appropriate compro- 10860 Flow Diagram Step Generation Section Filter Tuning Program Port Bytes Command LTRJ Comments This command initiates loading trajectory parameters input buffers Port Bytes Command Comments Busy-bit Check Module These bytes trajectory control word indicates acceleration velocity position will loaded both acceleration velocity absolute while position relative Busy-bit Check Module Acceleration loaded data words These bytes high data word Busy-bit Check Module acceleration data word (low) Busy-bit Check Module Velocity loaded data words These bytes high data word Busy-bit Check Module velocity data word (low) Busy-bit Check Module Position loaded data words These bytes high data word Busy-bit Check Module position data word (low) Busy-bit Check Module must issued execute desired trajectory Busy-bit Check Module RDSTAT This command reads Status Byte directly supported LM628 hardware executed time pulling logic Status information remains valid long logic decision Trajectory Complete interrupt continue Otherwise loop back RDSTAT This command resets only interrupts indicated zeros bits through next data word also resets fifteen Signals Register host interrupt (pin don't care Zeros bits through indicate interrupts will reset This wait block inserts delay between repetitions step input delay application specific good range values delay 5000 Loop back RSTI wait loop FIGURE Step Generation Section Filter Tuning Program Hardware Considerations motor control system oscilloscope trace system step response graph real position shaft versus time after small instantaneous change desired position LM628-based system extra hardware needed view system step response During step voltage across motor represents system step response oscilloscope used generate graph this response (voltage) LM629-based system extra hardware needed view system step response Figure illustrates circuit this purpose During step voltage output this circuit represents system step response oscilloscope used generate graph this response oscilloscope trigger signal rectangular pulse train taken from host interrupt output (pin LM628 LM629 This signal generated combination trajectory complete interrupt reset interrupts (RSTI) command Flow Diagram Note circuit Figure used view step response LM628-based system Note traces were generated using following ``step'' trajectory parameters relative position counts absolute velocity counts sample acceleration counts sample sample These values generated good small-signal step input reference system other systems will require different trajectory parameters general step trajectory parameters consist small relative position high velocity high acceleration position parameter must relative Otherwise define home command (DFH) must added main loop step generation section filter tuning program Flow Diagram circuit viewing system step response uses 8-bit analog-to-digital converter Figure prevent converter overflow step position parameter must higher than counts Note circuit Figure produces ``inverted'' step response graph oscilloscope input inverted produce positivegoing (more familiar) step response graph Observations What follows example oscilloscope traces step response reference system Note traces were generated using circuit Figure Figure represents step response under damped control system this response exhibits excessive overshoot long settling time filter parameters used generate this response were follows 1000 Figure indicates need increase derivative gain coefficient Figure represents step response over damped control system this response exhibits excessive rise time which indicates sluggish system filter parameters used generate this response were follows 1000 Figure indicates need decrease Figure represents step response critically damped control system this response exhibits virtually zero overshoot short rise time filter parameters used generate this response were follows 4000 1000 10860 FIGURE Circuit Viewing System Step Response with Oscilloscope LM628 Programming Guide 10860 FIGURE Step Response Under Damped Control System 10860 FIGURE Step Response Over Damped Control System 10860 FIGURE Step Response Critically Damped Control System LIFE SUPPORT POLICY NATIONAL'S PRODUCTS AUTHORIZED CRITICAL COMPONENTS LIFE SUPPORT DEVICES SYSTEMS WITHOUT EXPRESS WRITTEN APPROVAL PRESIDENT NATIONAL SEMICONDUCTOR CORPORATION used herein Life support devices systems devices systems which intended surgical implant into body support sustain life whose failure perform when properly used accordance with instructions provided labeling reasonably expected result significant injury user critical component component life support device system whose failure perform reasonably expected cause failure life support device system affect safety effectiveness AN-693 National Semiconductor Corporation 2900 Semiconductor Drive 58090 Santa Clara 95052-8090 1(800) 272-9959 (910) 339-9240 National Semiconductor GmbH Livry-Gargan-Str D-82256 F4urstenfeldbruck Germany (81-41) 35-0 Telex 527649 (81-41) 35-1 National Semiconductor Japan Sumitomo Chemical Engineering Center Bldg 1-7-1 Nakase Mihama-Ku Chiba-City Ciba Prefecture (043) 299-2300 (043) 299-2500 National Semiconductor Hong Kong 13th Floor Straight Block Ocean Centre Canton Tsimshatsui Kowloon Hong Kong (852) 2737-1600 (852) 2736-9960 National Semiconductores Brazil Ltda Deputado Lacorda Franco 120-3A Paulo-SP Brazil 05418-000 (55-11) 212-5066 Telex 391-1131931 NSBR (55-11) 212-1181 National Semiconductor (Australia) Building Business Park Drive Monash Business Park Nottinghill Melbourne Victoria 3168 Australia 558-9999 558-9998 National does assume responsibility circuitry described circuit patent licenses implied National reserves right time without notice change said circuitry specifications Other recent searchesSTB100NH02L - STB100NH02L STB100NH02L Datasheet S1613XP - S1613XP S1613XP Datasheet RB085T-90 - RB085T-90 RB085T-90 Datasheet MS-320-3 - MS-320-3 MS-320-3 Datasheet HFT2183-522 - HFT2183-522 HFT2183-522 Datasheet HFT2184-522 - HFT2184-522 HFT2184-522 Datasheet HFT218x-521 - HFT218x-521 HFT218x-521 Datasheet AML71 - AML71 AML71 Datasheet AML71 - AML71 AML71 Datasheet 2SC4419 - 2SC4419 2SC4419 Datasheet
Privacy Policy | Disclaimer |