Pulse width modulated sine cosine generator
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates to a pulse width modulated sine and cosine wave generator. 
     2. Description of the Prior Art 
     In the field of numerical control, resolver and Inductosyn feedback devices requires two sine waves ninety degrees apart or in quadrature. These sine waves can of course be generated with elaborate equipment, but the simplest way to maintain the precise quadrature relationship is by the use of waves derived from a counter driven by a constant frequency clock. However, as is well known, square waves are rich in harmonic content so that considerable filtering is required. It is therefore recognized in the art that it would be helpful to eliminate or suppress the undesired odd harmonics, particularly the third, fifth and seventh, to reduce filtering requirements. 
     An article appearing in EDN published by Cahners Publishing Co. Inc., Boston, Mass. 02116 on Jan. 15, 1971 entitled &#34;Reduce Static Inverter Weight and Cost by Harmonic Neutralization&#34; -- P. W. Koetsch, describes a technique for the suppression of the odd harmonics in a square wave output, utilizing a pulse width modulation technique. In this article there is described a static inverter, operating in the switching mode, that generates a square wave output that contains odd harmonics. Since the fundamental only was of interest, the pulse width technique was utilized to eliminate troublesome harmonics. In this technique, the on and off switching is controlled to produce a square pulse output wave of variable time width by using a stable oscillator and a countdown procedure. 
     The instant invention proposes to use the technique of pulse width modulation in a novel manner, to generate two sine waves exactly in quadrature, with minimal circuitry and greater flexibility in the selection of the pulse width pattern. 
     SUMMARY OF THE INVENTION 
     The present invention relates to a pulse width modulated sine and cosine wave generator. A read only memory (ROM) means is used to control the modulo of a counter. A first counting means addresses the ROM with all bit outputs save the most significant bit. The ROM has programmed outputs, two of which provide sine and cosine half cycle outputs (logic ONES and ZEROES) and the remaining programmed outputs are applied to the variable modulo counter. When the variable modulo counter has counted to its capacity it is enabled and an end of state signal is sent to the first counting means, which then advances to its next state, causing the ROM to have impending a new modulus for the variable modulo counter. When the variable modulo counter is enabled it receives the ROM output which is the modulo from the previous state of the first counting means. 
     Thus the duration of the state of the first counting means determines the duration of the logic ONES and ZEROES in the ROM sine and cosine half cycle outputs. The most significant bit of the first counting means, and the logic ONES and ZEROES of the ROM sine and cosine half cycle outputs are applied to circuitry for Boolean algebraic logic operations to derive pulse width modulated sine and cosine waves. 
     The ROM is programmed to provide a desired pulse width pattern. If it is desired to change this pattern to eliminate or minimize certain harmonics, this may be accomplished simply by replacing the ROM with one containing the desired data. 
    
    
     DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is an electrical schematic of the pulse width modulated sine-cosine wave generator in accordance with the invention; 
     FIG. 2A, 2B are tables showing how the ROM of FIG. 1 is programmed to provide variable moduli; and 
     FIGS. 3 and 4 are wave forms used in explaining the operation of the invention. 
    
    
     DESCRIPTION OF A PREFERRED EMBODIMENT 
     Referring now to FIG. 1, the pulse width modulated sin-cos generator of the invention is indicated generally at 10. This circuitry digitally generates: (a) a sine square wave SINSQW, (b) a pulse width modulated sin wave PWMSIN and (c) a pulse width modulated cos wave PWMCOS. These waves can be used for many applications requiring efficient generation of two sine waves in quadrature. 
     The invention is here illustrated as the excitation for a rotary control transformer (RCT) indicated generally at 12. Two sin waves are required to excite the stator windings S 1  S 3  ; S 2 , S 4  of the rotary control transformer 12. These sine waves must be 90° apart or in quadrature. It is important that the quadrature relationship be maintained with a high degree of precision. The output of the RCT 12, taken from the rotor windings R 1  R 2 , is an a.c. signal which is a function of the rotational displacement φ of the rotor. (When the RCT 12 is used in the numerical control, the sin square wave (SINSQW) is used as a mark for synchronization with other components). 
     The pulse width modulated sin-cos generator 10 comprises two binary 4 bit synchronous counters 14, 16, a read only memory (ROM) 18, NOT gate 20, EXCLUSIVE OR gates 22, 24, variable modulo counter 26, and drivers, 28, 30, 32. 
     Referring now to FIG. 2A and 2B, the ROM 18 is programmed to have the outputs Q 1  to Q 8  indicated in the tables. Counters 14 and 16 control the ROM address A 0 , A 1 , A 2 , A 3 , A 4 . The counter 14 addresses the ROM through 16 states OO to OF (FIG. 2A). At the end of state OF, there is a carry in (CI) to counter 16. The ROM 18 now receives a ONE on its A 4  address, and is successively addressed 10 through 1F. 
     Looking at line OO in FIG. 2A, the hexadecimal code E9 is 1110 1001 i.e. the outputs Q 8  . . . Q 5  ; Q 4 . . . Q 1 . The number 23 in binary form is 010111; the 2&#39;s complement of this number, 101001, is the ROM output Q 6  to Q 1 . The ROM output is loaded into counter 26 and it becomes the modulus. The counters 14, 16 and 26 are clocked by the clock pulse 4MHz. The number 23 is the number of 4MHz pulses that the counter 26 must count. Counter 26 counts up until it reaches all ONES. At that time an end of state EOST signal is sent to counter 14. (The EOST signal also enables the counter 26). When the counter 14 receives the EOST signal it goes to the next state, putting in the next address to the ROM 18, which then outputs a new modulo to the counter 26. No new modulo is loaded into the counter 26 until it is enabled (LD). The status quo will be maintained until counter 26 counts up to all ONES and another end of state signal EOST is sent to the counter 14. 
     Referring again to FIGS. 2A and 2B, the Q 7  and Q 8  outputs of the ROM are the cosine half cycle COSHC and the sine half cycle SINHC respectively. 
     The 4 bit synchronous counter 14 has a modulus of 16. As is well appreciated by those in the art, counters (and registers too) cannot distinguish numbers which differ only by an integral multiple of its modulus. However, in order to simplify the dicussion, the second sequence of the counter wll be identified as going from 16-32, the third sequence from 32-48 etc., realizing of course, that the actual counter simply repeats itself over and over again. 
     Referring now to FIGS. 1 and 3, the generation of the sine square wave (SINSQW) is as follows. The output Q 2  of counter 16 is connected to NOT gate 20 so that the inversion of its logic state is gated to driver 28. At the outset, assume that the outputs of Q 1  and Q 2  of counter 16 are logic ZEROES. Counter 14 counts up to 16 and a carry in (CI) pulse of 8 kilo Hz is sent to counter 16, whereupon the output Q 1  of counter 16 is changed to a logic ONE. (Q 2  remains ZERO). The Q 1  output of counter 16 is appled to ROM 18 as address A 4 . Counter 14 begins its second sequence which will be identified as counting from 16-32. When all ONES are reached, counter 16 sends a C.I. to counter 16, changing Q 1  to ZERO, and changing Q 2  to a logic ONE. Counter 14 counts now from 32 to 48, and sends CI to counter 16, changing Q 1  to a logic ONE (Q 2  remains a logic ONE). Counter 14 counts from 48 to 64, sending a C.I. to counter 16. Output Q 1  goes from logic ONE to logic ZERO, and Q 2  goes from a logic ONE to logic ZERO. In summary, Q 2  has been a ZERO for two count sequences of counter 14, and has been a ONE for the next two count sequences of counter 14. These logic states are inverted by NOT gate 20 and applied to driver 28 to provide SINSQW. 
     The generation of the SINHC and COSHC is essentially the same, so that only the SINHC output will be explained. The SINHC is the output Q 8  of ROM 18. As will be seen from a study of FIG. 2A, 2B, Q 8  changes from ONE to ZERO in a predetermined sequence. 
     In order to make clear the generation of SINHC the following table is presented: 
     
         ______________________________________                                    
                          COUNTER 26                                      
LINE NO.    ROM           MODULUS    SINHC                                
______________________________________                                    
                          46                                              
1F          23      →                                              
                          23         1                                    
00          23      →                                              
                          23         1                                    
01          35      →                                              
                          35         1                                    
02          32            32         0                                    
03          32            32         1                                    
04          26            26         1                                    
05          49            49         0                                    
06          14            14         1                                    
07          32            32         1                                    
08          14            14         1                                    
09          49            49         0                                    
0A          26                       1                                    
______________________________________                                    
 
    
     Assume that the counters 14, 16 are at line 1F (FIG. 2B) the ROM&#39;s impending output Q 1  to Q 6  is 23, counter 26 has a modulus 46 and SINHC is a ONE. When counter 26 counts 46 pulses, an EOST signal is sent to counter 14, and it goes to the next line OO. The EOST signal is also the load signal (LD) to counter 26 and the previous ROM state Q 1  - Q 6  i.e. 23, is now loaded into counter 26; this becomes the new modulo for counter 26. When the counter 14 goes to the next line, OO ROM 18 receives a new address A 0  - A 5 , and is now ready to send a new output Q 1  . . . Q 6  which is again 23. Counter 26 now counts 23 pulses and EOST is sent to counter 14. At line 01 the ROM&#39;s impending outut Q 1  . . . Q 6  is 35; counter 26 receives the output 23 from ROM 18. Counter 26 now counts 23 pulses whereupon the end of state signal EOST is sent to counter 14 sending it to the next line 02, and counter 16 receives the ROM output 35. ROM now has the state Q 1  . . . Q 6  = 32. Counter 26 now counts 35 pulses, and then sends to EOST to counter 14 indexing it to line 03. 
     At this point it will be convenient to summarize what has taken place. From line 00 to 01, the counter 26 has counted 46 pulses (23 + 23), and the SINHC has remained ONE. At step 02, counter 26 has counted 35 pulses and SINHC is a ZERO. This is shown in FIG. 3, where the SINHC is a ONE for 46 counts and a ZERO for 35 counts. 
     In line 03 and 04 the counter 26 will count 64 pulses (32 + 32) and the SINHC will be ONE. For line 05 counter 26 wll count 26 pulses and the SINHC will be ZERO. For lines 06 to 08, the counter 26 will count 95 pulses (49 + 14 + 32), while SINHC will be ONE. For line 09 counter 26 will count 14 pulses and the SINHC will be ZERO. These counting periods, as well as the logic state of sin HC and COSHC are shown in FIG. 3, for one half cycle i.e. 1000T. 
     As had been assumed earlier the output Q 2  of counter 16 is a ZERO for counts 1-32 and a ONE 32-64. When Q 2  is ZERO, the EXCLUSIVE -- OR&#39;s 22 and 24 will have a ONE output only when the other input i.e. SINHC or COSHC is a ONE. When Q 2  becomes a ONE, they will have a ONE output only when the other input is ZERO. 
     In this manner the EXCLUSIVE OR gates deliver the pulse width modulated sin (PWMSIN) and cosine (PWMCOS) wave patterns depicted in FIG. 4. 
     The pulse width pattern is determined by mathematical analysis. 
     In summary, the counters 14, 16 have 32 states i.e. a modulo 32 counter. The variable-modulo counter 26 changes state every 4MHz clock pulses. The EOST out of counter 26 is one clock period wide and is used to gate a number generated by the ROM to preset the counter 26 at the next clock pulse. The EOST signal advances the modulo 32 counter to its next state at the same time as the variable modulo counter 26 is being preset. The ROM 18 acts as a look up table, selecting the proper number (modulo) to preset the variable modulo counter 26, thus establishing the duration (in terms of MHz clock pulses) of the next state of the modulo 32 counter. The counter 14, 16 can generate the desired pulse width modulated signals PWMSIN and PWMCOS, if the ROM is programmed such that each state of the modulo counter 14, 16 has the desired pulse width or duration. 
     In order to simplify the design, in the practical embodiment, the maximum duration of the modulo 32 counter is kept at 64 clock pulses. In cases where the pulse width requires a longer duration, successive modulo 32 counter 14, 16 states are used until the correct duration is attained and/or until all 32 states are used. 
     The second function of the ROM 18 is to decode the five least significant bits of the modulo 32 counter and output the desired logic state (&#34;1&#34; or &#34;0&#34;) for the PWMSIN and PWMCOS during that particular state of the modulo 32 counter 14, 16. Because of the symmetry of the sine and cosine, only a half cycle is encoded, and the most significant bit of the modulo 32 counter 14, 16 (SINSQW) is utilized by means of a pair of EXCLUSIVE-OR gates to complement the encoded states which repeat for the second half cycle, to produce the desired PWMSIN and PWMCOS waves. 
     The ue of ROM control of the generator and for decoding the discrete logic states, enable the utilization of minimal circuitry, but nevertheless provides great flexibility in the selection of the pulse wave pattern. 
     The harmonic content of the PWSIN and PWCOS signals can be tailored to minimize certain harmonics of the carrier frequency to accommodate particular gain-bandwidth characteristics of different resolver type devices. This can be accomplished by changing the widths or durations of the discrete pulses during a half cycle of the carrier frequency. This pulse width customizing is accomplished simply by replacing the ROM 18 with another ROM containing the required modulo outputs.