Error and calibration pulse generator
This invention relates to an error and calibration pulse generator. 
     BACKGROUND OF THE INVENTION 
     A conventional universal timer/counter (UTC) makes single-shot pulse duration measurements by counting the number of periods of the master clock that occur between the beginning and end of the pulse to be measured. The resolution of the UTC is therefore limited by the master clock period. FIG. 1 illustrates an arrangement which permits the measurement resolution of the UTC to be improved. As shown in FIG. 1, the input pulse is applied to a timer 2 and to a start error pulse generator 4 and a stop error pulse generator 6. The start error pulse generator generates a start error pulse of duration equal to the interval between the beginning of the input pulse to be measured and the arrival of the next subsequent clock edge. Similarly the stop error pulse generator generates a stop error pulse of duration equal to the interval between the end of the input pulse to be measured and the arrival of the next subsequent clock edge. The start and stop error pulses are used to charge respective capacitors. The capacitors are later discharged at a known lower rate and the time that each capacitor takes to discharge is measured. If, for example, the discharge rate is one hundredth of the charge rate, the discharge time would be one hundred times the error time, and if the discharge time is measured with the clock&#39;s resolution, the single-shot resolution of the UTC is improved by a factor of one hundred. Such capacitive pulse stretchers are well known. 
     The start error pulse generator shown in FIG. 1 is of conventional form. 
     Before carrying out a measurement, the pulse generator is armed by placing each of the flip-flops 12 and 14 in its reset condition, so that each of them has a logical 0 (low) at its Q output terminal and a logical 1 (high) at its /Q output terminal. The pulse generator is then enabled by placing a logical 1 at the D input terminal of the flip-flop 12. 
     The input pulse to be measured is applied to the pulse generator by way of a signal input terminal 16, which is connected to the clock input terminal of the flip-flop 12. The input pulse is also applied to the timer 2 and to the stop time pulse generator 6. The start of the input pulse is marked by a positive-going transition at the terminal 16, from logical 0 to logical 1. In response to this transition, the Q terminal of the flip-flop 12 goes high and its /Q terminal goes low. When the /Q terminal of the flip-flop 12 goes low, the NOR gate 18 receives two low inputs and the output of the NOR gate goes high. This is the start of the start error pulse. When the next subsequent clock edge occurs, it is applied to the clock input terminal of flip-flop 14 and the Q terminal of the flip-flop 14 goes high and the output terminal of the NOR gate 18 goes low, marking the end of the start error pulse. 
     The stop error pulse generator 6 responds to the negative-going transition at the end of the input pulse and generates a stop error pulse having a duration equal to the difference between the time of arrival of the negative-going transition and the next subsequent clock edge. 
     The timer 2 counts the number of pulses between the first clock edge and the clock edge following the end of the input pulse. 
     The duration of the pulse to be measured is then equal to the number of clock periods counted by the timer 2 multiplied by the clock period, plus the duration of the start error pulse, minus the duration of the stop error pulse. 
     In order to provide accurate and consistent measurements, it is necessary to calibrate the capacitive pulse stretcher and its associated circuitry. In many applications, good measurement practice requires that the pulse stretcher be calibrated once per measurement. Conventional start and stop error pulse generators do not permit calibration of the pulse stretcher without interfering with the pulse generators when in the measurement mode. 
     SUMMARY OF THE INVENTION 
     In accordance with the present invention, an electronic circuit for selectively generating two output pulses that differ in duration by a predetermined amount has a clock terminal for receiving clock transitions at precisely determined intervals and comprises first and second sequential logic devices, a combinational logic device and a network that couples the clock terminal of the circuit to the sequential logic devices and also couples the second sequential logic device to the combinational logic device. The first and second sequential logic devices each have a data input terminal, a clock input terminal and an output terminal, and each has a first state in which the output terminal is at one of two binary logic levels and a second state in which the output terminal is at the other of the two binary logic levels. The combinational logic device has a first input terminal coupled to the output terminal of the first sequential logic device, a second input terminal coupled to the output terminal of the second sequential logic device, and an output terminal at which the desired two output pulses are provided. The coupling network has first and second separately selectable state such that in the first state of the coupling network a change in the state of the first sequential logic device brings about a change in the state of the second sequential logic device after a first predetermined number of clock transitions, whereas in the second state of the coupling network a change in the state of the first sequential logic device brings about a change in the state of the second sequential logic device after a second predetermined number of clock transitions, the second number being different from the first number. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     For a better understanding of the invention, and to show how the same may be carried into affect, reference will now be made, by way of example, to the accompanying drawings in which: 
     FIG. 1 is block diagram of a UTC including a conventional start error pulse generator, 
     FIG. 2 is a block diagram of a first start error and calibration pulse generator embodying the present invention, 
     FIG. 3 is a block diagram of a second start error and calibration pulse generator embodying the present invention, and 
     FIG. 4 is a block diagram of a third start error and calibration pulse generator embodying the present invention. 
     In the different figures of the drawings, like reference numerals designate corresponding elements. 
    
    
     DETAILED DESCRIPTION 
     The circuit shown in FIG. 2 is similar to that shown in FIG. 1, except that it also enables two calibration pulses, the difference in duration of which is precisely known, to be generated. The FIG. 2 circuit thus has a measurement mode and a calibration mode. 
     The signal input terminal 16 of the circuit shown in FIG. 2 is connected to the clock terminal of the flip-flop 12 through an OR gate 22. The master clock terminal 24 of the FIG. 2 pulse generator is connected to the OR gate 22 through a switch 26. The Q terminal of the flip-flop 12 is connected to the D terminal of the flip-flop 14 through a network which comprises an OR gate 28, a flip-flop 30 and a second switch 32. In the measurement mode, a control device 34 renders the switch 26 non-conductive and the switch 32 conductive. In the measurement mode, the FIG. 2 circuit operates in the same manner as the FIG. 1 start error pulse generator. 
     In the calibration mode, the switch 26 is conductive, and the signal input terminal 16 is isolated from the signal source. The circuit is armed by placing each flip-flop in its reset condition, and the circuit is enabled by placing a logical 1 at the D terminal of the flip-flop 12. The circuit is set to generate a short calibration pulse by placing the switch 32 in its conductive state. The first positive-going clock edge applied to the clock terminal of the flip-flop 12 through the OR gate 22 causes the Q terminal of the flip-flop 12 to go high, and the /Q terminal to go low. The output terminal of the NOR gate 18 goes high, signifying the start of the short calibration pulse. The logical 1 at the Q terminal of the flip-flop 12 is transmitted through the switch 32 and the OR gate 28 to the D input of the flip-flop 14. On arrival of the next clock pulse, the Q output of the flip-flop 14 goes high, and the output of the NOR gate 18 goes low, signifying the end of the short calibration pulse. 
     In order to generate a long calibration pulse, the circuit is again armed and enabled, but the switch 32 is rendered non-conductive. When the first clock pulse is received at the clock input terminal of the flip-flop 12, the /Q terminal of the flip-flop 12 goes low and, as before, the output of the NOR gate 18 goes high. However, because the switch 32 is non-conductive, the high at the Q terminal of the flip-flop 12 is not applied to the D terminal of the flip-flop 14. When the second clock pulse arrives, the Q output of the flip-flop 30 goes high, and this high is applied to the D terminal of the flip-flop 14 through the gate 28. On arrival of the third clock pulse, the Q terminal of the flip-flop 14 goes high. The output of the NOR gate 18 goes low, signifying the end of a long calibration pulse. 
     If the delay through one of the circuit blocks shown in FIG. 2 is represented by D i , where i is the reference numeral associated with that block, and the clock period is represented by T, then the duration of the short calibration pulse is equal to T+D 14  -(D 26  +D 22  +D 12 ). The duration of the long calibration pulse is equal to 2T+D 14  -(D 26  +D 22  +D 12 ). The difference between the durations of the short and long calibration pulses is equal to T (a known value), while the difference (D 14  -(D 26  +D 22  +D 12 )) between the duration of the short pulse and T is equal to the internal delay of the circuit. Thus, if the short calibration pulse and the long calibration pulse are applied successively to a capacitive pulse stretcher, the gain and offset of the pulse stretcher can both be measured. 
     A second start error and calibration pulse generator is shown in FIG. 3. In the measurement mode, the pulse generator is armed and enabled, and the switches 40 and 44 are non-conductive and the switch 42 is conductive. When the input terminal 16 of the circuit goes high, the /Q output of the flip-flop 12 goes low. Since the Q output of the flip-flop 14 is already low, the output of the NOR gate 18 goes high. When the /Q output of the flip-flop 12 went low, its Q output went high. Therefore, on the first clock pulse following the transition at the terminal 16, the Q output of the flip-flop 46 goes high, and on the second clock pulse the Q output of the flip-flop 14 goes high and the output of the NOR gate 18 goes low. In the calibration mode, the signal input terminal 16 is isolated and held low. The switch 40 is conductive, and for generating a short calibration pulse, the switch 44 remains non-conductive and the switch 42 remains conductive. At the first positive clock edge, the /Q output of the flip-flop 12 goes low and the output of the NOR gate 18 goes high. On the second clock edge, the Q output of the flip-flop 46 goes high, and on the third clock edge the Q output of the flip-flop 14 goes high and the output of the NOR gate 18 goes low. The duration of the short clock pulse is 2T+D 12  +D 14  +D 40 . 
     In order to generate a long calibration pulse, the switch 42 is non-conductive and the switch 44 is conductive. Clock pulses at the terminal 24 are applied to a frequency scaler 48, and therefore clock edges are applied to the circuit at half the frequency at which clock edges arrive at the terminal 24. The operation of the FIG. 3 circuit in generating the long calibration pulse will be self-evident, and it will also be apparent that the duration of the long clock pulse is equal to 4T+D 12  +D 14  +D 40 . The difference between the duration of the short and long calibration pulses is then equal to 2T. 
     When the circuit shown in FIG. 4 is in the start error mode, the switches 26 and 32 are non-conductive and conductive respectively, and the output of the NOR gate 18 goes high in response to the positive edge of the input signal applied to the terminal of the circuit. Three clock pulses later, the output of the NOR gate goes low, indicating the end of the start error pulse. In the calibration mode, the switch 26 is conductive, and the switch 32 is conductive for generating a short calibration pulse. At the first clock pulse, the /Q output of the flip-flop 12 goes high and the output of the NOR gate 18 goes low, as in the case of FIG. 2. On the second clock pulse, the Q output of the flip-flop 50 goes high, and on the third clock pulse the Q output of the flip-flop 14 goes high. The output of the NOR gate 18 goes low, marking the end of the short calibration pulse. When the switch 32 is non-conductive, the same sequence of events occurs except that on the third clock pulse the output of the flip-flop 30 goes high and it is not until the fourth clock pulse that the output of the flip-flop 14 goes high and the output of the NOR gate 18 goes low. 
     It will be appreciated that the present invention is not restricted to the particular circuits that have been described and illustrated, and that variations may be made therein without departing from the scope of the invention as defined in the appended claims and equivalents thereof. For example, it is not necessary to use both outputs of the flip-flop 12, since the /Q output can be generated from the Q output by inversion. If the NOR gate 18 is replaced by an AND gate and the /Q output of the flip-flop 14 is applied to one input of the AND gate, the Q output of the flip-flop 12 may be applied directly, i.e., without inversion, to the other input of the AND gate.