Speed control apparatus for sewing machine
BACKGROUND OF THE INVENTION 
     The present invention relates to an apparatus for controlling the speed of sewing by applying a speed instructive pulse signal to the sewing machine&#39;s driving and braking mechanism. 
     Conventional sewing machine speed control apparatuses have been provided with a speed detector, a counter for counting the number of pulses generated by the speed detector at an interval proportional to the sewing machine&#39;s rotational speed, a control circuit for producing a speed instructive pulse signal to a driving means (such as a clutch motor) or a braking means (such as an electromagnetic brake) of the sewing machine in accordance with the pulse count, an oscillator for setting the timing for applying the pulse count to the control circuit, and a speed setting circuit for setting the rotational speed of the sewing machine, and for outputting the set speed to the control circuit. Sewing machine speed was controlled so that, at the same time that an oscillator pulse was applied to the control circuit, the counter content was applied to the control circuit. The control circuit would compare the counter content with the instruction from the speed setting circuit and provide an instruction to the driving means or the braking means. 
     However, in the conventional sewing machine speed control apparatus, it was impossible to control the driving means and the braking means more finely than the interval of pulses of the oscillator would permit, because the application of the output of the counter to the control circuit was controlled by the synchronization provided by the oscillator. As a result, even when the difference between the speed set by the speed setting circuit and the actual running speed was very small, the content of the counter was not entered into the control circuit during the oscillation period of the pulse, so that the previously set speed was continuously applied until the next pulse was produced, so that ripples in the speed became large. 
     SUMMARY OF THE INVENTION 
     Accordingly, an object of the present invention is therefore to eliminate this defect. 
     Another object of the present invention is to provide an improved sewing machine speed control apparatus in which the width of a speed instructive pulse for the driving means or braking means may be varied in order to provide finer, more accurate control. 
     To attain the above-mentioned objects, the inventive sewing machine speed control apparatus comprises a speed detecting means for detecting a rotational speed of a sewing machine, a speed setting means for setting a desired rotational speed of the sewing machine, and a control circuit responsive to respective output signals of the speed detecting means and the speed setting means for producing a speed instructive pulse signal to a driving means and a braking means of the sewing machine, the control circuit being arranged such that, every speed control period, the pulse width of the speed instructive pulse signal is varied in accordance with the difference between the actual rotational speed and the desired setting speed of the sewing machine. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     Other features and advantages of the invention will be apparent from the following description taken in conjunction with accompanying drawings, in which: 
     FIG. 1 is a block diagram of the sewing machine speed control apparatus according to the present invention; 
     FIG. 2 is a flowchart showing the control procedure of the apparatus of FIG. 1; 
     FIG. 3 is a explanatory diagram showing an exemplary arrangement of a table provided in a memory of the apparatus of FIG. 1 for producing a speed instructive pulse; 
     FIG. 4 is a time chart showing the temporal relation of the control pulses to the oscillator pulse in the apparatus of FIG. 1; and 
     FIG. 5 is a block diagram of an alternative embodiment of the invention. 
    
    
     DETAILED DESCRIPTION OF A PREFERRED EMBODIMENT 
     Referring to the drawings, a preferred embodiment of the present invention now will be described. 
     In FIG. 1, a memory 1 storing a program or the like is connected to a microprocessor (CPU) 2 for executing a control operation in accordance with the program stored in the memory. A programmable input/output (I/O) port 3 is connected to the CPU 2, and transistors 5 and 9 are connected at their respective bases to the I/O port 3 through resistors 4 and 8, respectively, so that the operation of transistors 5 and 9 is controlled by the I/O port 3. The respective collectors of the transistors 5 and 9 are connected to a power source through diodes 6 and 10 for protecting emitters of the transistors are grounded. An exciting (CL) coil 7 of a driving means, such as clutch motor, is connected across the diode 6 so that, when the CL coil 7 is excited, the driving means drives a sewing machine 12, as will be described later. Another exciting (BK) coil 11 of a braking means, such as an electromagnetic brake, is connected across the diode 10 so that when the BK coil is excited, braking force is applied to the sewing machine 12. 
     A sewing machine 12 is connected to an input of a speed detector 13, and transmits pulses representing sewing machine speed. The output of the speed detector passes to an input of a counter 14 for counting the number of pulses. The output of the counter 14 passes to the I/O port 3. A speed setting means 15 and an oscillator 16 are connected to the I/O port 3 and the CPU 2, respectively. 
     The operation of the inventive speed detector now will be described, for the case in which a high speed is set by the speed setting means 15. The CPU 2 receives the number of pulses detected by speed detector 13 and counted by the counter 14, through the I/O port 3. (Every revolution of the sewing machine apparatus produces a number of pulses.) The CPU 2 receives the pulse count at a predetermined interval, as defined by the oscillator 16, in the following manner. When the oscillator 16 applies a pulse, the counter contents received by the CPU 2 are processed according to the flowchart shown in FIG. 2. The memory 1 contains a table of time intervals for producing a speed setting pulse, as shown in FIG. 3, as well as a program, according to the flowchart of FIG. 2. 
     As an example, the value N corresponding to the speed is 8. The counter contents are read into the CPU 2 through the I/O port 3 (step 20), and the BK coil 11 and the CL coil 7 are controlled in accordance with the flowchart of FIG. 2 based on the received counter content CT and the value of N (8). As shown in FIG. 2, the CPU compares N. and CT, and if they are different, the period of time for exciting the BK coil 11 and CL coil 7 is varied in accordance with the difference. 
     Referring to FIGS. 2, 3, and 4, specific control processing for varying the exciting time will be described. When the CT is 8, N=CT, so that &#34;0&#34; is stored in each of BK and CL (step 22), and the counter is cleared (step 23) and reset (step 24). Thus, neither the BK coil nor the CL coil is excited, and the output is not varied in a period Ts of the oscillator 16, that is, in one speed control period. 
     If CT of the counter 14 is 10 when a next pulse is received, CT&gt;N, so that &#34;1&#34; and &#34;0&#34; are set in BK and CL respectively, whereby the BK coil is excited. At the same time, the difference between N and CT is calculated and stored in Sa (step 25). The CPU 3 looks up the table of FIG. 3 (step 26) using the value of Sa as a key (step 26) and sets a timer constant T2, since CT-N=2 (step 27). The above condition is maintained for this period T2 (steps 28 to 30). Thereafter &#34;0&#34; is stored in each of BK and CL (step 22), so that the BK coil is no longer excited. Accordingly, the BK coil 11 is excited only for a period T2. 
     If CT is 9 when the next pulse is produced, Sa becomes 1 so that T1 is set as the result of looking up in the table and &#34;1&#34; and &#34;0&#34; are set in BK and CL respectively for a period T1. Thus, the BK coil 11 is excited only for the time of T1. 
     If CT is 5, N is larger than CT, so that &#34;0&#34; and &#34;1&#34; are stored in BK and CL, respectively, 3 is set in Sa (step 31), and the CPU 2 looks up in the table (step 32) to thereby set a period T3 (step 33) for exciting the CL coil. Then, &#34;0&#34; is stored in each of BK and CL when the period T3 has elapsed, so that the CL coil is no longer excited. 
     Speed control generally continues to be performed as described above. However, when Sa is equal to or larger than 6, the BK coil 11 or the CL coil 7 is excited for one speed control period, that is the oscillation period Ts of the oscillator 6. When the speed set by speed setting means 15 varies, different tables for the time Tn&#39;, Tn&#34;, etc., corresponding to the various values of N, may be used. 
     Although a program controlled timer using table look up is used for providing the time Tn in the above-described embodiment, an external timer circuit 17, as shown in FIG. 5, may be used. Further, although speed is varied by changing the value of N in the aforegoing embodiment, the same effect can be obtained by changing the frequency of the oscillator 16 in accordance with the change in speed set by the speed setting means 15. 
     To summarize, in the present invention, a function of pulse width modulation is introduced for the sewing machine speed control so as to change the pulse width in accordance with a difference between an actual rotational speed and a desired speed of the sewing machine, enabling highly accurate speed control.