Patent Publication Number: US-5293628-A

Title: Data processing system which generates a waveform with improved pulse width resolution

Description:
FIELD OF THE INVENTION 
     The present invention relates in general to data processors, and more particularly to waveform generation in a digital data processor. 
     BACKGROUND OF THE INVENTION 
     Microcomputers today are used to control a wide variety of products ranging from a simple household appliance to a complex automobile. One of the important uses carried out by the microcomputer is timing control. Timing control can also range from the very simple to the very complex. A household appliance may only require a microcomputer timer to count how much time has elapsed between two events in order to control the appliance. An automobile, on the other hand, may require the timer to generate or recognize complex waveforms in order to control the automobile engine. 
     An important use for timer functions, other than control, is the generation of clocks for communication systems. Communication systems transfer data between multiple locations. Some communication systems require one or more clocks in order to determine when the various bits of data are to be sent. A timer is a convenient device which can be used to generate the clocks required by a communication system. A timer can also be used to generate a wide range of output waveforms that can be used for purposes other than control and the clocking of communication information. 
     In order to discuss timers, it is necessary to define the basic terminology of a waveform, such as period, cycle, frequency, pulse width, and duty cycle. Period and cycle are being used synonymously in this document. The period or cycle of a waveform is the length of time between any two rising edges or any two falling edges of the waveform. The frequency of a waveform is the inverse of the period, that is frequency=1/period. As the period increases, the frequency decreases. Therefore, a waveform with a long period has a low frequency. 
     The pulse width of a waveform is the length of time that the pulse remains in a predetermined state, either high or low. The duty cycle of a waveform is the percentage of time that the waveform is high during the total waveform period. For example, a waveform that has a 70% duty cycle is high for 70% of the total period and low for the remaining 30% of the period. A waveform that has a 50% duty cycle is high for 50% of the total period and low for the remaining 50% of the period. And a waveform with a 20% duty cycle is high for 20% of the total period and low for the remaining 80% of the period. 
     Many timers operate by using an input clock, a counter, and some type of compare logic. The counter is used to keep track of the length of time that has elapsed from an initial starting time. The counter is incremented by the first edge of the input clock. On the second edge of the input clock, the contents of the counter are compared to a preprogrammed value to determine if the two values match. If a match occurs, the timer has determined that a sufficient length of time has elapsed since the initial starting time. The timer then performs the appropriate function, such as causing an interrupt or driving a value on an output pin. If a match does not occur, the timer has determined that a sufficient time has not elapsed since the initial starting time and the counter is again incremented on the next edge of the input clock. 
     Because the counter value changes after each increment, the compare operation must be performed after each increment of the counter. If a compare is not performed after each increment, a match may occur and yet go undetected. There are only two edges during each period of the input clock. The first edge is used to increment the counter and the second edge is used to trigger the compare operation. As a result, the counter can only be incremented once during each period of the input clock. Thus the effective rate at which the counter can count is limited by the frequency of the input clock. A standard counter with an input clock frequency of &#34;F&#34; can only count at the rate of &#34;F&#34;. For example, a counter with an input clock of 6 megahertz can only count at the rate of 6 megahertz. 
     The rate at which a counter can count determines the resolution of the timer. The resolution of existing timers is limited by the frequency of the input clock. Many microcomputer customers want timers that have greater resolution. And unfortunately, the easy solution of merely increasing the frequency of the input clock in order to increase the resolution of the timer is usually not a viable option. The input clock to the timer is usually the fastest system clock operating throughout the entire microcomputer. Increasing the speed of this system clock affects all parts of the system, not just the timer. Some circuitry within the microcomputer will not operate correctly above a certain maximum frequency, and this maximum frequency may not be great enough to produce the required resolution in the timer. 
     SUMMARY OF THE INVENTION 
     The previously mentioned needs are fulfilled and other advantages achieved with the present invention. In one form, the present invention comprises an apparatus and a method for generating an output signal with a reduced pulse width resolution period. The data processing system comprises a data processor for providing a control signal, a clock generator for providing a clock signal of predetermined period, and a logic means. The logic means has a clock input coupled to the clock signal, a control input coupled to the data processor for receiving the control signal, and an output signal. The output signal has a pulse width determined by the control signal, and a pulse width resolution period which is equal to the predetermined period of the clock divided by a power of two. The logic means selectively adjusts the output signal by a predetermined amount in order to lengthen the output signal in response to the control signal. 
     The present invention will be understood by one skilled in the art from the detailed description below in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1A illustrates, in timing diagram form, output waveforms generated by a prior art device; 
     FIG. 1B illustrates, in timing diagram form, output waveforms generated by one embodiment of the present invention; 
     FIG. 2 illustrates, in block diagram form, a data processing system having circuitry with a reduced pulse width resolution period in accordance with one embodiment of the present invention; 
     FIG. 3 illustrates, in block diagram form, a high resolution counter module of FIG. 2 in accordance with one embodiment of the present invention; 
     FIG. 4 illustrates, in partial logic diagram form, a resolution selection logic circuit of FIG. 3 in accordance with one embodiment of the present invention; and 
     FIG. 5 illustrates, in partial logic diagram form, a waveform completion and edge adjust logic circuit of FIG. 3 in accordance with one embodiment of the present invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The terms &#34;assert&#34; and &#34;negate&#34; will be used when referring to the rendering of a signal, status bit, or similar apparatus into its logically true or logically false state, respectively. The symbol &#34;%&#34; preceding a number indicates that the number is represented in its binary or base two form. 
     FIG. 1A illustrates output waveforms A, B, and C which are generated by a prior art timing device. The prior art timing device has a pulse width resolution period (PWRP) equal to one period of the input clock. 
     Pulse width resolution period (PWRP) is a characteristic of a device that generates waveforms, it is not a characteristic of a single waveform itself. The PWRP of a device is determined by comparing the duration of two pulses that have as close to the same pulse widths as the device is capable of producing. For example, referring to the prior art in FIG. 1A, the durations of the pulse widths of waveforms A, B, and C are as close to the same pulse width as the prior art timing device is capable of producing. To determine the PWRP, the pulse widths of the shortest pulse (output waveform A) and the next shortest pulse (output waveform B) are compared. The difference in duration of the two pulses is the length of time labeled &#34;PWRP&#34;. The PWRP of the prior art timing device is equal to one period of the input clock. The timing device&#39;s PWRP remsins constant for all other waveforms that the device generates using the same configuration. For example, output waveforms B and C also differ in duration by one period of the input clock. 
     The pulse width resolution period of a device is measured in units of time and for many applications it is advantageous for a device to have as small a PWRP as possible. A smaller PWRP allows a device to generate pulses with intermediate pulse widths that cannot be generated by a device with a larger PWRP. These intermediate pulse widths may be required by certain peripheral devices, such as stepper motors or communication receivers, which are receiving and using the pulses generated by the timing device. 
     As discussed above, FIG. 1A illustrates output waveforms A, B, and C which are generated by a prior art timing device. The prior art device uses the input clock signal as an input to a three-bit counter (not shown). The counter is incremented on every other edge of the input clock signal. Each arrow in FIG. 1A indicates an increment of the counter. The numbers above the arrows indicate the value that is contained in the counter before the increment takes place. The three-bit counter starts with the value of 0 and increments by one until the counter contains the maximum count value of 7. When the counter contains the value 7 and is incremented by one, the counter rolls over to 0. The remaining edges of the input clock, in this example the rising edges, are used for a compare operation (not shown) and cannot be used to increment the counter. 
     FIG. 1B illustrates the improvement over the prior art which is provided by the present invention. An approach was needed that increased the resolution of the timer without requiring an increase in the frequency of the input clock to the timer. 
     FIG. 1B illustrates output waveforms D, E, and F which are generated by one embodiment of the present invention. This embodiment uses the same input clock signal as the prior art. The input clock signal is used as an input to a four-bit counter (not shown). Just like the prior art, the counter is incremented on every other edge of the input clock signal. Each arrow in FIG. 1B indicates an increment of the counter. The numbers above the arrows indicate the value that is contained in the counter before the increment takes place. The four-bit counter starts with the value of 0 and counts up to the value 14 by increments of two. When the counter contains the value 14 and is incremented by two, the counter rolls over to 0. The remaining edges of the input clock, in this example the rising edges, are used for a compare operation (not shown) and cannot be used to increment the counter. 
     The PWRP illustrated in FIG. 1B is equal to one-half of one period of the input clock and was generated by one embodiment of the present invention. Thus the PWRP of the illustrated embodiment is one-half of the PWRP of the prior art using the same input clock period. This is a significant improvement over the prior art. The present invention allows a prior art device to be modified by a small amount of circuitry in order to produce a doubling of performance. Decreasing the PWRP of a device from a full period of the input clock to one-half a period of the input clock is a doubling of performance. Although the performance improvement illustrated in FIG. 1B is only double that of the prior art, the present invention will also permit a four times increase in performance, an eight times increase in performance, and in fact a 2 N  increase in performance where N is an integer. 
     FIG. 2 illustrates a data processing system 10 which has a data processor 12, a clock generator 14, and a high resolution counter module 16. High resolution counter module 16 may optionally be part of the timer or serial subsystem 18 within data processing system 10. Clock generator 14 generates an input clock 20 which is an input to high resolution counter module 16. High resolution counter module 16 generates an output waveform 22. 
     Data processor 12 outputs several control signals to high resolution counter module 16, including duty control signals 24, a resolution control signal 26, a polarity signal 28, and a reset signal 30. In the present embodiment, duty control signals 24 are multiple signals, but other embodiments may use only one signal to transmit duty control information from the data processor 12 to the high resolution counter module 16. 
     The present invention requires that duty control information be transmitted from the data processor 12 to the high resolution counter module 16. The remaining control signals, resolution control signal 26, polarity signal 28, and reset signal 30, are optional. These three optional control signals are used in the present embodiment of the invention, but they are not required. 
     Still referring to FIG. 2, the high resolution counter module 16 uses the input clock 20 and all of the control inputs from data processor 12 in order to generate the output waveform 22. Output waveform 22 can be generated so that it has a pulse width resolution period (PWRP) that is equal to the period of the input clock 20 divided by a power of two. Similar prior art devices can only generate output waveforms with a PWRP that is equal to the period of the input clock 20. This is a disadvantage of prior art devices. For many applications it is advantageous for a device to have as small a PWRP as possible. A smaller PWRP allows a device to generate pulses with intermediate pulse widths that cannot be generated by a device with a larger PWRP. These intermediate pulse widths may be required by certain peripheral devices, such as stepper motors or communication receivers, which are receiving and using the pulses generated by the timing device. 
     FIG. 3 illustrates in greater detail the structure of the high resolution counter module 16 of FIG. 2. High resolution counter module 16 contains a duty compare logic 32, a counter 34, a resolution selection logic 36, and a waveform completion and edge adjustment logic 38. Counter 34 contains N counter stage circuits, of which four counter stage circuits, counter stage 0 circuit 40a, counter stage 1 circuit 40b, counter stage 2 circuit 40c, and counter stage N circuit 40d, are illustrated. 
     Duty compare logic 32 receives duty control signals 24 as inputs. Also, duty compare logic 32 receives, as inputs, the contents of each counter stage, counter stage 0 circuit 40a, counter stage 1 circuit 40b, counter stage 2 circuit 40c, and counter stage N circuit 40d. Duty compare logic 32 generates two output signals, a duty compare match 42 and an edge adjust 44, which are inputs to the waveform completion and edge adjustment logic 38. 
     Resolution control signal 26 is an input to both the resolution selection logic 36 and the waveform completion and edge adjustment logic 38. Input clock 20 is likewise an input to both the resolution selection logic 36 and the waveform completion and edge adjustment logic 38. Resolution selection logic 36 outputs STAGE 0 IN signal 46 as an input to counter stage 0 circuit 40a. Also, resolution selection logic 36 outputs STAGE 1 IN signal 48 as an input to counter stage 1 circuit 40b. Counter stage 0 circuit 40a outputs STAGE 0 OUT signal 50 as an input to resolution selection logic 36. Counter stage N circuit 40d outputs an end of period signal 52 as an input to the waveform completion and edge adjustment logic 38. 
     Polarity signal 28 and reset signal 30 are both inputs to the waveform completion and edge adjustment logic 38. Waveform completion and edge adjustment logic 38 generates output waveform 22. 
     Although FIG. 3 illustrates an N-stage or N-bit counter, the particular embodiment that will be described will be a four-bit counter that is able to produce the output waveforms illustrated in FIG. 1B. The extension from a four-bit counter to an N-bit counter merely requires the addition of more counter stages and the repetition of existing logic in the duty compare logic 32. So in the described embodiment, N=4 and counter 34 is a four-bit counter. 
     In operation, counter 34 performs a counting function. One of the counter stages receives the input clock 20 as an input. Which counter stage receives the input clock 20 as an input determines whether the counter 34 counts or increments by one, by two, by four, or by 2 N . 
     During each period, input clock 20 has two edges. On the first edge of input clock 20, the counter is incremented by either one, two, four, or 2 N . On the second edge of input clock 20, the contents of counter 34 (i.e. the contents of each counter stage 40a, 40b, 40c, and 40d) are compared to a user programmed value in duty compare logic 32 in order to determine if there is a match. On the next first edge of input clock 20, the counter is again incremented and this cycle of increment and compare is continued until a match is found. 
     Once a match is found, the duty compare match signal 42 is asserted to indicate that the logic state of output waveform 22 should be inverted by the waveform completion and edge adjustment logic 38. The counter 34 continues to count. When counter 34 reaches its maximum count value and rolls over to its lowest count value, counter stage N circuit 40d produces an end of period signal 52 which indicates that the end of the period of the output waveform 22 has been reached and that the logic state of output waveform 22 should once again be inverted by the waveform completion and edge adjustment logic 38. Consequently, the period of the output waveform 22 is determined by the amount of time it takes for counter 34 to increment from its lowest count value to its maximum count value and then roll over to its lowest count value again. 
     In the present embodiment, the period of output waveform 22 can be programmed by selecting how many stages of counter 34 will actually be utilized. The more stages that counter 34 utilizes, the higher the maximum count value. The higher the maximum count value, the longer it takes to count up from the lowest count value to the maximum count value, and thus the longer the period of output waveform 22. For example, if the user selects to utilize only three stages of counter 34, then the output of counter stage 2 circuit 40c passes directly through all higher counter stages and is output from counter stage N 40d as the end of period signal 52. If a counter stage is utilized, its input from the prior stage does not pass through, but is instead used as a carry in bit by the receiving counter stage. 
     The duty control signals 24 determine the duty cycle of output waveform 22. The duty cycle of output waveform 22 is the percentage of time that output waveform 22 is high during its total waveform period. Note, however, that if polarity signal 28 indicates that the polarity of output waveform 22 is inverted, then the duty cycle of output waveform 22 is the percentage of time that output waveform 22 is low during its total waveform period. 
     In the disclosed embodiment of the present invention, the duty control signals 24 represent a number of half-cycles or half-periods of input clock 20. If the polarity of output waveform 22 is not inverted, then a value of &#34;2&#34; transmitted by duty control signals 24 indicates that output waveform 22 is high for &#34;2&#34; half-periods (or one full period) of input clock 20. Output waveform D in FIG. 1B illustrates an output waveform 22 that has a duty control 24 value of &#34;2&#34;. A value of &#34;3&#34; transmitted by duty control signals 24 indicates that output waveform 22 is high for &#34;3&#34; half-periods of input clock 20. Output waveform E in FIG. 1B illustrates an output waveform 22 that has a duty control 24 value of &#34;3&#34;. Likewise, a value of &#34;4&#34; transmitted by duty control signals 24 indicates that output waveform 22 is high for &#34;4&#34; half-periods (or two full periods) of input clock 20. Output waveform F in FIG. 1B illustrates an output waveform 22 that has a duty control 24 value of &#34;4&#34;. 
     Note that output waveforms D and F in FIG. 1B both have an &#34;even&#34; duty control 24 value. Output waveform D is high for &#34;2&#34; half-periods of input clock 20 and output waveform F is high for &#34;4&#34; half-periods of input clock 20. Because the counter 34 which produced the output waveforms illustrated in FIG. 1B was incremented by two, the counter 34 contents incremented from 0 to 2, to 4, to 6, up to the maximum even value of the counter 34 before it rolled over to 0 again. Thus, counter 34 could match the duty control 24 value and produce output waveform D when the counter contained the count value &#34;2&#34;. Likewise, the counter 34 contents could match the duty control 24 value for output waveform F when the counter contained the count value &#34;4&#34;. 
     However, a problem arises when the duty control 24 value is &#34;odd&#34; rather than &#34;even&#34;. Because the counter 34 is counting by two, the counter value will always be even and a match will never occur with an &#34;odd&#34; duty control 24 value. The case of &#34;odd&#34; duty control 24 values is thus treated specially. If the counter 34 is counting by two and the duty control 24 value is &#34;odd&#34;, the least significant bits of both the counter 34 and the duty control 24 value are not compared. So counter stage 0 circuit 40a is not compared to the least significant bit of the duty control 24 value. However, all of the remaining bits are still compared. Thus an &#34;odd&#34; duty control 24 value will cause a match on the next smaller &#34;even&#34; counter value. For example, if the least significant binary bits are not compared, a &#34;3&#34; represented in binary by %0011 will match with a &#34;2&#34; represented in binary by %0010. Likewise, any odd number represented in binary by %xyz1 will match with the next smaller even number represented in binary by %xyz0. 
     Therefore, for &#34;odd&#34; duty control 24 values, a match occurs on the next smaller &#34;even&#34; counter value. So for &#34;odd&#34; duty control 24 values, the duty compare match signal 42 is asserted too soon. To correct for this premature assertion of duty compare match signal 42, duty compare logic 32 sends an edge adjust signal 44 to the waveform completion and edge adjustment logic 38. This edge adjust signal 44 indicates to the waveform completion and edge adjustment logic 38 that it should wait one extra input clock 20 edge before inverting the logic state of output waveform 22. Thus for all &#34;odd&#34; duty control 24 values, the length of time that the output waveform 22 is high, (assuming that the polarity of output waveform 22 is not inverted), is lengthened or delayed by one-half input clock 20 period. 
     The duty compare logic 32 determines whether the duty control 24 value is &#34;even&#34; or &#34;odd&#34; by looking at the least significant binary bit of the duty control 24 value. If the least significant binary bit of the duty control 24 value is a &#34;0&#34;, the value is even and no edge adjust delay is required. If the least significant binary bit of the duty control 24 value is a &#34;1&#34;, the value is odd and an edge adjust delay is indeed required. 
     As an illustration, output waveform E in FIG. 1B has a duty control 24 value equal to &#34;3&#34;, which is represented in binary as %0011. Duty compare logic 32 ignores the least significant bit of the counter 34 and finds a match when the counter contains &#34;2&#34;, which is represented in binary as %0010. Note that a duty control 24 value equal to &#34;2&#34; would also have resulted in the duty compare match signal 42 being asserted at the same time. But because the duty control 24 value is &#34;odd&#34;, duty compare logic 32 also asserts the edge adjust signal 44. The waveform completion and edge adjustment logic 38 uses the edge adjust signal 44 to differentiate between the &#34;even&#34; case when the inversion of output waveform 22 should not be delayed and the &#34;odd&#34; case when the inversion of output waveform 22 should be delayed one-half period of the input clock 20. 
     As a result of incrementing counter 34 by two and delaying the inversion of output waveform 22 for all &#34;odd&#34; duty control 24 values, the high resolution counter module 16 is able to produce waveforms with one-half the pulse width resolution period (PWRP) of prior art devices. This is a doubling of performance. 
     Although FIG. 3 of the disclosed embodiment only illustrates a counter 34 which can produce output waveforms 22 with the same performance or double the performance of prior art devices, it would be possible to extend the present invention to produce waveforms with 2 N  times the performance of prior art devices. However, the complexity of the edge adjust circuitry would increase. 
     For example, to get a four times performance increase, counter 34 must be incremented by four and the least two significant bits must not be compared. The duty compare logic 32 then finds a match when counter 34 contains &#34;4&#34; or binary %0100 if the duty control 24 value is &#34;4&#34;, &#34;5&#34;, &#34;6&#34;, or &#34;7&#34;. Instead of simply using the edge adjust signal 44 to indicate whether the duty control 24 value is &#34;even&#34; or &#34;odd&#34;, duty compare logic 24 must now differentiate between four possible values that differ from each other in their binary representations by the two least significant bits. 
     In addition, to get a four times performance increase, the two edges which occur during one input clock 20 period are not sufficient to produce the required delay periods. A signal must be available that has four edges during one input clock 20 period in order to produce output waveforms with a pulse width resolution period (PWRP) equal to one-fourth of the input clock 20 period. The requirement of a signal that has four edges during one input clock 20 period (i.e. a signal twice the frequency of input clock 20) defeats part of the advantage of the present invention. The present invention achieves a doubling of performance using the same input clock 20 frequency as the prior art and without requiring any signal that has a frequency greater than input clock 20. 
     Moving on to another part of FIG. 3, resolution selection logic 36 is used to choose between possible configurations of high resolution counter module 16. Resolution selection logic 36 programmably selects which stage of counter 34 is directly incremented by input clock 20. Which counter stage is directly incremented by input clock 20 determines whether the counter 34 counts by one, by two, by four, or by 2 N . If counter stage 0 circuit 40a is directly incremented by input clock 20, then counter 34 is incremented by one. If counter stage 1 circuit 40b is directly incremented by input clock 20, then counter 34 is incremented by two. And if counter stage N circuit 40d is directly incremented by input clock 20, then counter 34 is incremented by 2 N . 
     In the illustrated embodiment, resolution control signal 26 indicates to resolution selection logic 36 whether the user is programmably choosing to increment counter 34 by one or by two. If the user chooses the &#34;increment by one&#34; configuration, the resulting output waveform 22 will have a pulse width resolution period (PWRP) equal to one input clock 20 period, which is the same as the prior art. But if the user chooses the &#34;increment by two&#34; configuration, the resulting output waveform 22 will have a PWRP equal to one-half of the input clock 20 period, which is double the performance of the prior art. In the general case, the &#34;increment by 2 N  &#34; configuration, the resulting output waveform 22 will have a PWRP equal to the input clock 20 period divided by 2 N , which is 2 N  times the performance of the prior art. 
     It is important to note that other embodiments of the present invention do not require resolution control signal 26 and resolution selection logic 36. Other embodiments could directly hardwire input clock 20 to one fixed stage of counter 34. But if input clock 20 is directly hardwired to one fixed stage of counter 34, the PWRP of the output waveforms 22 produced will be fixed. The advantage of using resolution control signal 26 and resolution selection logic 36 is that the user can programmably reconfigure the circuitry to choose a different length of the PWRP of the output waveform 22. 
     FIG. 4 illustrates one implementation of the resolution selection logic 36. Referring to both FIG. 3 and FIG. 4, the resolution control signal 26 determines whether input clock 20 is input to counter stage 0 circuit 40a across STAGE 0 IN signal 46 or whether input clock 20 is input to counter stage 1 circuit 40b across STAGE 1 IN signal 48. If input clock 20 is being input to counter stage 0 circuit 40a, then STAGE 0 OUT signal 50, which is the output of counter stage 0 circuit 40a, is fed into the input of counter stage 1 circuit 40b across STAGE 1 IN signal 48. If input clock 20 is being input to counter stage 1 circuit 40b, then counter stage 0 circuit 40a, STAGE 0 IN signal 46, and STAGE 0 OUT signal 50 are not used. 
     FIG. 5 illustrates one implementation of the waveform completion and edge adjustment logic 38. The circuitry of waveform completion and edge adjustment logic 38 can be functionally divided into three sub-blocks. 
     The first sub-block is edge adjust logic 60. Edge adjust logic 60 receives four signals as inputs, namely edge adjust 44, resolution control 26, duty compare match 42, and input clock 20. These four input signals are used to determine whether output waveform 22 should be inverted, and if so, whether the inversion of output waveform 22 should be delayed by one-half of the input clock 20 period. Output waveform 22 is inverted when duty compare match 42 indicates that there has been a match. The inversion of the output waveform 22 is only delayed if the resolution control signal 26 indicates that the counter 34 is counting by two, and the edge adjust signal 44 indicates that the duty control 24 value is &#34;odd&#34; rather than &#34;even&#34;. If a delay is required, edge adjust logic 60 generates that delay. 
     The second sub-block is polarity determination logic 62. This sub-block is optional. Polarity determination logic 62 merely determines whether the initial state of output waveform 22 is high or low. By convention, the duty cycle of a waveform is the percentage of time that the waveform is high during the total waveform period. Polarity determination logic 62, in effect, allows the user to define the duty cycle of output waveform 22 as either the percentage of high time or the percentage of low time, depending upon whether the initial state of output waveform 22 is chosen to be high or low. This is useful because different peripheral devices which receive and use output waveform 22 require different polarities. Some peripheral devices require the initial state of output waveform 22 to be high, and some devices require the initial state to be low. 
     The third sub-block is reset and end of period determination logic 64. The reset portion of this circuitry is optional. The reset 30 input to this sub-block merely forces the value of the output waveform 22 to a particular reset state. In alternate embodiments, the reset 30 signal could be a control signal for disabling output waveform 22 or for performing some other function which required the output to be forced to a known state. In the present embodiment, whether the reset state of output waveform 22 is high or low is defined by the polarity determination logic 62. 
     The remaining circuitry in the reset and end of period determination logic 64 causes output waveform 22 to be inverted when the end of the period of output waveform 22 has been reached. Counter 34 asserts the end of period signal 52 when counter 34 reaches its maximum count value and rolls over to its lowest count value. The end of period signal 52 is received by the reset and end of period determination logic 64 and is used to indicate that the end of the period of output waveform 22 has been reached and that the logic state of output waveform 22 should once again be inverted. 
     In summation, the above specification describes a data processing system 10 having a high resolution counter module 16 which has improved pulse width resolution. By incrementing counter 34 by a predetermined power of two and delaying the inversion of the output waveform 22 for duty control 24 values that are not exactly a power of two, the pulse width resolution period (PWRP) can be improved by the predetermined power of two. For example, incrementing counter 34 by two and delaying the inversion of the output waveform 22 for &#34;odd&#34; duty control 24 values, the pulse width resolution period (PWRP) can be reduced by one-half which is a doubling of performance. 
     While the present invention has been illustrated and described with reference to specific embodiments, further modifications and improvements will occur to those skilled in the art. For example, the data processing system 10 may or may not be contained on a single semiconductor chip. As an example of this, data processor 12 may be contained on a semiconductor chip and clock generator 14 may be an oscillator that is not contained on that same semiconductor chip. The high resolution counter module 16 may be part of a timer or serial subsystem 18 within data processing system 10. Various frequencies of input clock 20 could be used, with the maximum frequency determined by the limitations of the circuitry. The number of stages in counter 34 may be any number. Also, counter 34 may be a down counter that decrements rather than increments, and thus counter 34 counts down until it rolls over from its minimum count value to its maximum count value. 
     As an additional modification, the edge adjustment of output waveform 22 could be made for all &#34;even&#34; duty control 24 values rather than for all &#34;odd&#34; duty control 24 values. Instead of output waveform 22 being lengthened for all &#34;odd&#34; values, output waveform 22 could be shortened by one-half input clock 20 period for all &#34;even&#34; values. In order to be able to shorten output waveform 22, there must be a delay in the actual inversion of output waveform 22 in order to allow for any shortening of output waveform 22 that is required. 
     It is to be understood, therefore, that this invention is not limited to the particular forms illustrated and that it is intended in the appended claims to cover all modifications that do not depart from the spirit and scope of this invention.