Abstract:
Circuitry for providing timing signals spaced in time by a varying amount, the circuitry including calculating means for repetitively performing a calculation to repetitively provide calculation signals the value (SUM) of which varies as a function of the number of times the calculation has been repeated, and timing signal generating means for receiving the calculation signals and providing a series of timing signals spaced in time by varying amounts, a timing signal being generated each time the value (SUM) has changed by a set amount (ACC).

Description:
This is a continuation of co-pending application Ser. No. 496,459 filed on May 20, 1983, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     The invention relates to apparatus for providing timing signals spaced in time by a varying amount, and in particular to apparatus for providing timing signals to a stepping motor. 
     A stepper motor rotates a given angle in response to each digital step signal that it receives, and in many applications it is desirable to accelerate a stepper motor at a fixed maximum rate. To cause acceleration of the stepper motor, it is necessary to successively decrease the time periods between the step signals; specifically, the time period between timing signals should be proportional to the reciprocal square root of the number of steps that have been taken. 
     SUMMARY OF THE INVENTION 
     In general the invention features circuitry for providing timing signals spaced in time by a varying amount, the circuitry including calculating means for repetitively performing a calculation to repetitively provide calculation signals the value (SUM) of which varies as a function of the number of times the calculation has been repeated, and timing signal generating means for receiving the calculation signals and providing a series of timing signals spaced in time by varying amounts, a timing signal being generated each time the value (SUM) has changed by a set amount (ACC). 
     In preferred embodiments the circuitry includes a programmable digital computer and program, the calculating means and the timing signal generating means being implemented as steps of the program; the calculating means repetitively provides calculation signals the value (SUM) of which varies quadratically with respect to the number of times the calculation has been repeated; the calculating means provides the calculation signals spaced in time by equal amounts; the timing signal generating means includes means to compare SUM with a comparison value and comparison adjustment means to adjust the comparison value each time a timing signal is generated (preferably either by decreasing SUM by the set amount ACC or by setting the comparison value to the product of ACC and NSTEPS, where NSTEPS is the number of timing signals that have been generated); the calculating means includes count adjustment means to adjust the value N of a count signal each time a calculation signal has been provided, so that SUM varies quadratically with respect to N; the count adjustment means includes means to selectively increase N each time a calculation signal is provided or decrease N each time a calculation signal is provided or cause N to remain the same each time a calculation signal is provided, so that the period between the timing signals respectively decreases, increases or remains the same with respect to time; the timing equal generating means includes acceleration/deceleration means to selectively adjust the count adjustment means in response to the number of timing signals that have been provided; the apparatus is used to provide timing signals for a stepper motor to operate a given number of steps by accelerating at a constant rate to a fixed speed, by operating at the fixed speed and by decelerating at a constant rate so that the given number of steps is reached as the deceleration is completed, and the count adjustment means increases N each time a calculation signal is provided until N reaches a value corresponding to the fixed speed, the acceleration/deceleration adjustment means provides a signal indicating how many steps were required to reach the fixed speed, and the count adjustment means maintains N at that value until the number of steps remaining to reach the given number of steps equals the number required to reach the fixed speed, at which time N is decreased each time a calculation signal is provided; the repetitive calculation comprises repetitively adding N+N+1 or repetitively adding N. 
     Using the invention, one can simply and efficiently provide timing signals, e.g. by using simple adding, subtracting and comparison operations, without the need for more complicated multiplication, division or square root operations. In particular the invention can be used to efficiently and simply drive a stepper motor to provide a given number of steps in a given time at maximum permissible acceleration, deceleration and speed. 
    
    
     Other features and advantages of the invention will be apparent from the following description of the preferred embodiment, and from the claims. 
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     FIG. 1 is a diagram of apparatus driven by a stepper motor according to the invention. 
     FIG. 2 is a functional block diagram of circuitry used to provide timing signals in the FIG. 1 stepper motor apparatus. 
     FIG. 3 is a flow chart of a program implemented by the FIG. 2 circuitry. 
     FIG. 4 is a flow chart of an alternative method to provide timing signals spaced in time by a varying amount. 
     FIG. 5 is a partial functional block diagram for circuitry to carry out said alternative method. 
    
    
     Referring to FIG. 1, there is shown stepper motor 10 for driving apparatus 12 in response to timing signals 14 provided by timing signal circuitry 18. Apparatus 12 includes chain 20 supported by sprockets 22 and arm 24 connected by means 26 to chain 20. Stepper motor 10 drives apparatus 12 via chain 28, which drives sprocket 30 connected to lower left hand sprocket 22. Apparatus 12 is described in more detail in U.S. Pat. No. 4,493,606 filed May 24, 1982, which is hereby incorporated by reference. 
     Referring to FIG. 2, a functional block diagram for circuitry 18 (an Intel 8080 microprocessor controlled by the program described in the flow chart of FIG. 3) is shown. Circuitry 18 includes calculating means 32, which repetitively performs a simple calculation via summing means 34 such that the value SUM of the output signals 36 varies quadratically with respect to the number of times that the calculation has been repeated. Calculating means 32 also includes count adjustment means 37 to adjust the value of N after each repetitive calculation has been completed. 
     Calculation signals 36 are repetitively spaced in time by a constant amount and are provided to timing signal generating means 38, including comparison means 40, comparison adjustment means 42 and acceleration/deceleration means 44. Comparison means 40 compares the value SUM of calculation signals 36 with a comparison value and provides timing signals 14 each time that the value (which comparison value is zero in the algorithm described in FIG. 3) SUM exceeds the comparison value. Comparison adjustment means 42 provides a SUM adjustment signal to summing means 34 each time that a timing signal 14 has been provided. Acceleration/deceleration means 44 provides a signal to count adjustment means 37 after a plurality of timing signals 14 have been provided to control whether count adjustment means 37 increases or decreases after each calculation signal 36 to provide acceleration, constant speed, or deceleration. 
     In operation, circuitry 18 provides timing signals 14 to stepper motor 10 to drive arm 24 via chain 26 in both vertical and horizontal directions from the position shown between the right hand sprockets 22 in FIG. 1 to a position between the left hand sprockets 22 (as is shown in phantom in FIG. 1). After a certain operation occurs, arm 24 is moved back to the position between the right hand sprockets 22. The travel between the two positions takes a certain total number of steps of stepper motor 10. It is desirable that the travel between the two positions be accomplished in as short a time as possible; thus, stepper motor 10 is accelerated at a maximum permissible rate until a maximum speed is reached, and then it travels through a number of steps at the maximum speed and decelerates at a maximum deceleration rate to the end position. Timing signals 14 are shown diagrammatically in both FIGS. 1 and 2 to have decreasing periods of time between successive signals to provide acceleration. During the constant speed portion of the travel, timing signals 14 are separated in time by constant amounts. During the deceleration portion of the travel, the period of time between successive timing signals 14 increases. 
     During the acceleration portion of travel, the period between timing signals 14 is proportional to the reciprocal square root of the number of timing signals 14 that have been received so far. Timing signal generating means 38 provides signals 14 spaced in time by the desired varying time periods based upon the time it takes calculating means 32 to perform a repetitive calculation, regardless of the value of the calculated number. Specifically, calculating means 32 provides calculation signals 36 repetitively spaced in time by the time it takes summing means 34 to perform a simple addition step, and timing signal generating means 38 provides time signals 14. Timing signals 14 are provided when the value SUM changes by a prescribed constant amount ACC, and are spaced in time by varying amounts, because the value SUM of calculation signals 36 increases as the square of the number of calculations (generally equal to N) or as the square of time. During the acceleration stage, count adjustment means 37 increases N by one during each successive addition step of summing means 34. During the constant speed portion of travel, N remains constant; although SUM is increasing, it is increasing at a constant rate and not at a quadratically varying rate so that the timing between timing signals 14 is constant. During the deceleration phase of travel, count adjust means 37 decreases the value of N so that the value SUM decreases quadratically with time, and the time period between timing signals 14 increases with time. 
     Turning to FIG. 3, there is shown a flow chart for the computer program that provides timing signals 14. A listing of the program (in assembly language for the Intel 8080) is included below. The program of FIG. 3 implements the changes between the three modes of stepper motor operation (acceleration, deceleration, and constant speed) using the variable RAMP. The number of steps (or timing signals 14) taken in the acceleration and deceleration modes are equal. RAMP is intialized to the total number of steps RSTEPS remaining to be taken, and is decremented by two each time there is a timing signal 14 during the acceleration mode until the maximum fixed velocity is reached. N is incremented by one during the acceleration mode until the maximum velocity (related to N) is reached. The value of RAMP remaining at the end of the acceleration mode is precisely the number of constant velocity steps to be taken, and RAMP is decremented by one for the constant velocity steps, while N remains constant. When RAMP is equal to zero, the deceleration mode begins, and N is decremented by one until N equals zero, at which time the number of remaining steps, RSTEPS, equals zero. 
     Referring specifically to FIG. 3, initially the variable RAMP is set to the total number of steps remaining to be taken, or to RSTEPS, DELT, the number by which RAMP is decremented, is set equal to two; SUM is set equal to zero, and N is set equal to zero. Beginning the loop at point A on the flow chart, SUM is initially increased by adding to it N+N+1. As N is repetitively increased by one with each calculation from 0 to 1 to 2 to 3 to 4, etc., N+N+1 increases from 1 to 3 to 5 to 7 to 9 (i.e., the values are consecutive odd integers) and SUM increases from 1 to 4 to 9 to 16 to 25, etc.; i.e., SUM increases quadratically with respect to the number of times N that the calculation has been repeated. 
     Each time that SUM is greater than or equal to zero, a timing signal 14 is provided; SUM is decreased by constant amount ACC; the number of steps remaining to be taken, RSTEPS, is decremented by one; RAMP is decremented by two, and the computer is now at point B on the flow chart. RAMP is still greater than zero after the first timing signal 14 has been provided, and N is still less than a constant MAXVEL (a value corresponding to N when the velocity of stepping motor 10 is at its fixed maximum value); thus N is increased by one and the loop begins again at point A. 
     This time the SUM starts out at -ACC and is increased by N+N+1. SUM is less than zero; RAMP is still greater than zero; N is still less than MAXVEL; and N is increased by one through a plurality of repetitive summing calculations with SUM increasing quadratically with respect to the number of calculations until once again it is greater than or equal to zero. At this point, once again, a timing signal 14 is provided; the SUM is decreased by the constant ACC; RSTEPS is decremented by one; RAMP is decremented by DELT, and the computer is at point B on the flowchart. Assuming that RAMP is still greater than zero, and N is less than MAXVEL, N is increased by one, and SUM, which has just had the constant ACC subtracted from it, is increased by N+N+1. The computer continues to go through the loop after point B involving an increase in N by one during the repetitive calculations until once again SUM is greater than or equal to zero (in other words until SUM has increased by the amount ACC again). Because N is continuously increasing, the number of loops or repetitive calculations it takes SUM to increase from -ACC to zero decreases, and thus the time periods between timing signals 14 also decreases. This continues until the maximum velocity is reached, at which point N is greater than or equal to MAXVEL. 
     At this point stepper motor 10 goes in to the constant velocity mode, by continuing the repetitive calculations with N being a constant value, and DELT is set equal to one. Because N is constant, the number of steps it takes SUM to increase from -ACC to zero is constant, and the time periods between timing signals 14 are constant. Each time that a timing signal 14 is provided, RAMP is now decremented by one (because DELT has been set equal to one). 
     When RAMP equals zero the constant velocity mode is complete, and stepper motor 10 goes into the deceleration mode. At this point N is decremented by one, and thus each time a timing signal 14 is provided, it takes longer and longer for SUM to be increased from -ACC to zero, because SUM is increased during each repetitive calculation by a smaller value. When N equals zero, RSTEPS also equals zero, and travel of arm 24 is complete. 
     Listings of the program used by circuitry 18 in C language and in assembly language (slightly modified, as described below) are as follows: ##SPC1## 
     OTHER EMBODIMENTS 
     Other embodiments of the invention are within the scope of the following claims. 
     For example, in FIGS. 4 and 5 are shown a modified partial flow chart and a corresponding modified timing signal generating means. In this embodiment, SUM is once again repetitively increased by N+N+1, but instead of comparing the value SUM with zero and decreasing SUM by the constant ACC each time that a timing signal 14 is provided, in this case SUM is compared to the product of NSTEPS (the number of steps taken so far) times the constant ACC. Thus each time a timing signal 14 is provided, the comparison value, NSTEPS times ACC, increases by the amount ACC; thus SUM is required to increase by the amount ACC again before another timing signal is provided, and with increases in the value N, the time it takes to increase by ACC decreases. 
     Also, in place of repetitively adding odd numbers (the N+N+1 computation described above and in the C language listing) to have SUM increase as (N+1) 2 , other quadratic repetitive calculations can be used. For example, one can repetitively add N to have SUM increase as N(N-1)/2 or N 2  /2-N/2 (as in the assembly language listing); as SUM gets larger, N 2  /2 predominates so that SUM is still effectively quadratic with respect to N.