Abstract:
A method and apparatus for automatically detecting peak values of an applied unknown electrical signal employ a binary search technique in which a digital signal is converted to analog reference voltage levels one bit at a time from the most significant bit to the least significant bit to be compared with the unknown signal until finally a digital signal is produced which corresponds to a peak value. By selecting and controlling the comparator slope, both positive and negative peaks may be detected. The search for positive and negative peaks of signals occurring in one or more signal channels may be interleaved to decrease total detection time. From the detected values, a triggering voltage level may be arithmetically computed.

Description:
BACKGROUND OF THE INVENTION 
     It is often desirable to determine values of unknown DC voltage levels or time-varying signals without using an oscilloscope or an external voltmeter. It is also often desirable to make use of such values in a number of ways, such as determining a stable triggering point for repetitive signals, or making peak-to-peak voltage measurements, or making risetime and falltime measurements of pulse edges, et cetera. Such situations arise in the use of electronic counter or timer apparatus, wherein applied unknown signals or voltage levels are measured to determine such characteristics as frequency, elapsed time between electrical events, numbers of electrical events occurring, and so forth. Such electronic counter apparatus typically have an input voltage window to limit the positive and negative peak amplitudes to a predetermined dynamic range, and a triggering level within such triggering window through which a signal must pass to generate a count response by the counter circuits. An operator manually adjusts the triggering level by means of a front-panel control to set the triggering level at a point which will result in stable triggering. If the overall signal amplitude is much smaller than the triggering window, some hunting with the front-panel control is necessary to locate the signal, followed by trial-and-error adjustments to stabilize the count. 
     This problem has been recognized by other investigators in the art, and automatic level-detecting and triggering apparatus and methods have been developed. One such automatic triggering circuit is described in U.S. Pat. No. 4,121,164, which is assigned to the assignee of the present invention. Here, the trigger level voltage is automatically swept through the triggering window until the input signal voltage level is encountered. However, the sweeping of the triggering level continues so that triggering occurs at different arbitrary levels if the input signal is time varying. 
     U.S. Pat. No. 4,069,452 teaches an apparatus which automatically detects the precise values of upper and lower peaks, as well as the mid-point, of a time-varying signal. A series of stairstep voltage ramps scan predesignated ranges within the triggering window to encounter the input signal. When the general area of positive and negative peaks are determined, a smaller stair voltage ramp is used to precisely (within the step increment) locate the peaks. The midpoint between peaks may then be computed. This is a rather lengthy coarse-fine process, particularly if the input signal is changing very slowly or is a low-frequency repetitive signal. Furthermore, this system does not lend itself to accurate detection of fast electrical spikes occurring at a very low repetition rate, it cannot detect out-of-range signals, nor can it determine DC voltage levels because there is no facility for changing slope to allow sweeping in on the voltage level from both directions. In other words, a voltage level may be detected, but it is unknown whether such level is actually a signal peak or a DC voltage. 
     SUMMARY OF THE INVENTION 
     In accordance with the present invention, a binary search technique is utilized automatically and accurately to detect voltage levels of an applied unknown signal or DC voltage within a predetermined dynamic range or triggering window. The unknown signal or DC voltage is applied to one input of a voltage comparator. An n-bit digital signal generated by a logic control unit is converted to an analog reference voltage and applied to the other input of the comparator. The output of the comparator is coupled to an edge-triggered device utilized as a detection register, such as a toggled flip-flop or a counter, the status of which in turn is monitored by the logic control unit. A memory and an arithmetic unit complete the basic detection apparatus. The binary search technique involves a test cycle in which n-bit digital test level numbers are selected by the logic control unit in such a manner that the comparator reference voltage test levels converge within the triggering window to the peak values of signals. Once both the positive and negative peak values are known, a point midway therebetween may be calculated to establish a triggering level for autotriggering. Risetime and falltime measurements of pulse edges may be made by calculating the 10% and 90% points for time measurement therebetween. Each test level may be held for a predetermined time, if necessary, to detect low-frequency or low-duty-cycle signals. A no-signal or out-of-range condition may be detected as well. The search steps of positive and negative peak-locating test cycles may be interleaved so that both cycles are carried out concurrently. 
     In accordance with a specific implementation of the present invention, both channels of a dual-channel universal counter are tested at the same time, utilizing a microcomputer and its associated memory in conjunction with an input comparator and the initial counter stages in each channel. 
     It is therefore one object of the present invention to provide a method and apparatus for rapidly detecting signal levels of applied unknown signals using a binary search technique. 
     It is another object of the present invention to determine the values of unknown DC voltages or time-varying signals without the use of external test equipment. 
     It is a further object of the present invention to automatically provide stable triggering on a time-varying signal without prior determination of signal timing or amplitude characteristics. 
     It is an additional object of the present invention to detect two or more peak levels of two or more time-varying signals during a single search sequence. 
    
    
     Other objects and advantages will become apparent to those having ordinary skill in the art upon a reading of the following description when taken in conjunction with the accompanying drawings. 
     DRAWINGS 
     FIG. 1 is a block diagram of an automatic signal level detection apparatus in accordance with the present invention; 
     FIG. 2 is a waveform diagram illustrating the binary search technique as employed in locating the positive peak of an applied unknown time-varying signal; 
     FIG. 3 is a block diagram of a dual-channel counter input stage employing the automatic signal-detecting apparatus in accordance with the present invention; and 
     FIG. 4 is a waveform diagram illustrating an interleaved binary search for both positive and negative peaks of an applied unknown time-varying signal. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Referring now to FIG. 1, there is shown a generalized block diagram of an automatic signal level detection apparatus in accordance with the present invention. An unknown DC voltage or time-varying signal is applied via an input terminal 10 to one input of a comparator 12, where it is compared with a reference voltage applied to the other input thereof from a digital-to-analog converter (DAC) 14. The output of comparator 12 is applied to a transition detection device or detection register, such as an edge-triggered flip-flop 16. A logic control unit 18 generates n-bit digital signals as it sequences through a binary search cycle, changing one bit at a time from the most significant bit (MSB) to the least significant bit (LSB) until finally an n-bit digital number is reached, the equivalent analog voltage of which produced by DAC 14 matches either a DC voltage or a predetermined peak of a time-varying signal applied to input terminal 10. A memory 20 is provided for storing one or more n-bit digital numbers, including the one equivalent to the detected input value. An arithmetic unit 22 is coupled to the logic control unit 18 to provide mathematical functions, such as, for example, calculating risetime or falltime of pulse edges. The detected signal levels or mathematical results may be displayed by display unit 24. 
     The binary search technique which forms one aspect of the inventive matter employed by the apparatus of FIG. 1 may best be understood in terms of the example shown in FIG. 2. Referring to FIG. 2, there is shown a triggering window having a lower voltage limit L min  and an upper voltage limit L max . The triggering window is the dynamic range over which input signals may be detected, and is determined by the output of DAC 14, which produces the reference voltage E REF  for comparator 12. For this example, it is desired to determine the positive peak of some unknown signal, which is arbitrarily depicted as a low-level repetitive signal occurring generally in the lower half of the triggering window. Also for this example, logic control unit 18 is capable of producing 5-bit digital numbers ranging from 00000 at L min  to 11111 at L max , the specific 5-bit digital numbers being depicted by the logic diagram on the left-hand side of FIG. 2 wherein the black represents logical ones and the white represents logical zeroes. 
     At the beginning of a binary search cycle, nothing is known about the input signal, or even whether there is one, and so the logic control unit sets the 5-bit digital number to all ones in the example shown, establishing the reference voltage E REF  at L max  as shown. The first step is to determine the most significant bit of the 5-bit digital number which is equivalent to the positive peak of the input signal, and this is achieved by applying 01111 (or 10000) to DAC 14, setting E REF  exactly halfway between L max  and L min  to initiate the first test step t s1 . After setting the first reference level, the logic control unit 18 checks the status of flip-flop 16 to determine whether at least one transition has occurred, indicating that a signal has been detected, since the passing of E REF  through the signal voltage will generate a positive-going trigger edge to toggle the flip-flop. In the example shown, no signal is detected; however E REF  remains at the level set by the digital number 01111 for up to a time T in accordance with a timing circuit or clock internal to the logic control unit 18. The time T may be predetermined, and may be for example the time period for one cycle of input signal at a designated low-frequency cut-off point. That is to say, the positive peak should pass through the reference level E REF  within the time period T if it is going to at all. At the end of the time period T, the first test step t s1  is completed and E REF  is set back to L max  by changing the 5-bit digital number from 01111 to 11111. If the status of flip-flop 16 is unchanged at the end of t s1 , it is known that nothing is in the upper half of the triggering window. Therefore, the MSB of any value to be detected must necessarily be a logical zero. So 0 is placed in the memory as the most significant bit, with the remaining four bits yet to be determined. 
     The next test step, t s2 , is initiated to determine the second most significant bit by setting the 5-bit digital number to 00111, after which logic control unit 18 checks the status of flip-flop 16. Since in the FIG. 2 example E REF  passed through the signal in reaching the test level, comparator 12 produced a transition which toggled flip-flop 16. Thus it is known that a signal or DC voltage lies somewhere between the one-quarter and one-half points between L min  and L max , and there is no need to leave the test level at 00111 for the entire time period T. So test step t s2  is terminated, resetting E REF  to L max , and the detected logical one is stored as the second most significant bit. 
     In a like manner, the remaining three bits are determined as a 0, a 1, and a 1 by test steps t s3 , t s4 , and t s5 , respectively. The final detected signal, 01011, may be ascertained by inspection in FIG. 2 by comparing the positive peak with the logic diagram at the left-hand side of the illustration. 
     It can be discerned that if no signal is present within the triggering window, a binary search will be carried out wherein the n-bit digital number applied to DAC 14 will be changed one bit at a time in reverse order from the MSB to the LSB so that the reference voltage E REF  applied to comparator 12 will sweep through the triggering window, starting at L max  and converging toward L min  as shown by the dashed lines indicated as t&#39; s3 , t&#39; s4 , and T&#39; s5 . Thus may a no-signal condition and a range limit condition be detected and indicated. It may also be seen that if the unknown signal is much smaller than shown in the FIG. 2 example, or indeed only a DC level, the precise level would still be properly determined. This is because the apparatus in accordance with the present invention needs only a single transition to be observed in flip-flop 16, and further because the slope has been correctly chosen so that a countable transition occurs when E REF  crosses the unknown signal going in a negative direction (or when the unknown signal crosses E REF  going in a positive direction). 
     While FIG. 2 shows the binary search technique for detecting positive peaks of a signal, it should be understood the search for negative peaks is carried out in a similar manner with an opposite slope setting, beginning at L min  and sweeping upwardly into the triggering window. To observe proper polarity in operating the edge-triggered flip-flop 16, a slope control must be provided to ensure that a positive-going reference voltage E REF  in seeking the negative peak will produce the same polarity trigger as did a negative-going E REF  in seeking the positive peak. Such slope controls are well known in the art, and may be effected by either switching the + and - inputs of comparator 12 or by inverting the comparator output during negative peak search. However, it should be pointed out that inclusion of such slope control in combination with positive and negative peak detection is an important aspect of the present invention. 
     As mentioned previously, the detected values for both the positive and negative peaks of a signal are stored in memory 20. These values may be transferred to arithmetic unit 22 by the logic control unit 18, wherein, for example, the 50% point between peaks may be calculated to generate a triggering level to provide stable triggering of an input signal. If the comparator 12 and transition detection device 16 form part of the input stage of a digital counter, it is a significant attribute of the present invention that the components used in detecting signal levels are the same ones used for the actual signal processing. Such a dual role eliminates such design problems as component matching or drift compensation. Also, cost factors and power consumption of the host instrument are reduced. The arithmetic unit 22 may also calculate the traditional 10% and 90% points between signal peaks to facilitate risetime and falltime measurements of pulse transitions. The arithmetic unit may be useful in verifying the recognition of DC voltage levels, since in such a case the detected positive and negative peaks would be equal to each other. 
     FIG. 3 shows in block diagram form a dual-channel universal counter input stage employing the automatic signal-detecting apparatus of the present invention. Channel A comprises a comparator 40, the inputs of which are connected to an input terminal 42 and a trigger voltage source 44, respectively, a slope selection circuit 46 for selectively inverting the output of comparator 40, and a conventional edge-triggered count chain 48. Similarly, Channel B comprises a comparator 50, the inputs of which are connected to an input terminal 52 and a trigger voltage source 54, respectively, a slope selection circuit 56 for selectively inverting the output of comparator 50, and a conventional edge-triggered count chain 58. The trigger voltage sources 44 and 54 may suitably be conventional digital-to-analog converters operated as programmable voltage sources. A microcomputer 60, which may suitably be a conventional off-the-shelf microcomputer including a processor and a memory, controls the binary search for both positive and negative peaks of input signals for both channels A and B. The operation of channels A and B is substantially identical, with the microcomputer 60 selecting the polarity (slope) of the comparator output to establish the proper triggering edge for the count chains, setting the comparator reference voltages, and monitoring the counters in the count chains to determine if a change in count has occurred. The state of each count may be determined by either resetting them for each test step of the binary search cycle, or alternatively by keeping track of the count chain contents by reading and storing updated values. 
     FIG. 4 is a waveform diagram of an interleaved binary search for both positive and negative peaks, hereinafter referred to as peaks and valleys for convenience, of an applied unknown time-varying signal. The binary search cycle will be described in terms of i steps, wherein 1≦i≦n and i=1 for the MSB, and i=2 for the next MSB, and so on down to i=n for the LSB of an n-bit digital number applied from the microcomputer 60 to the trigger voltage sources 44 and 54. Each test step i is divided into a peak search t s ,pi and a valley search t s ,vi. The search cycle is initiated for each channel by setting the outputs of trigger voltage sources 44 and 54 to L max  and setting the slope select circuits 46 and 56 so that a positive-edge pulse will be produced if the input signal exceeds the trigger reference voltage. Then the trigger reference voltages, which will be subsequently controlled independently, are set to L 1  =(L max  +L min )/2. The microcomputer 60 reads the contents of the count chains 48 and 58, and the test step t s ,p1 is terminated either after a count has occurred, indicating the presence of a signal, or after a time period T, indicating the absence of a signal in the upper half of the trigger window. Thereafter, the triggering level is set to L min  and the slope set to negative to begin the valley search step t s ,v1. For i=1, the triggering level will be set to (L max  +L min )/2 to determine whether a signal is present at all within the triggering window, since it has already been determined that if there is one, it is in the lower half of the triggering window. Here, the signal is detected between L min  and L 1 , and consequently, the MSB is determined for both a signal peak V max  and a signal valley (or negative peak) V min . The process repeats for i=2 in determining the next most significant bit of both the peak and valley values, until finally the values for i=n are determined. 
     Since a valley always occurs between successive peaks, efficient use of computer time may be made by interleaving the binary searches for peak and valley values for both channels A and B. This is particularly true for low-frequency input signals where a wait time may be involved after setting a new triggering level. During the wait time, for example, the period T mentioned above, the computer 60 can go off and perform other functions. This may include setting a trigger reference level in another channel, reading any of the count chains, and so forth. For example, the first test step t s ,p1 may be conducted for channels A and B simultaneously since the count chains 48 and 58 may both be enabled at the same time, or one after the other, making the change of triggering level voltage to L min  upon completion of the t s ,p1 step. It should be pointed out that the binary search for peaks and valleys will be carried out in exactly the same number of steps for both channels A and B, since as mentioned earlier, what is really being determined by the binary search process is the values of binary bits of n-bit digital numbers corresponding to Channel A signal peak (VA max ) and valley (VA min ) and Channel B signal peak (VB max ) and valley (VB min ). From these values, a 50% triggering point may be calculated, or 10% and 90 % points of rising or falling edges may be calculated to facilitate risetime or falltime measurements. 
     Detection of DC voltages or time-varying signals having a frequency lower than the low-frequency cut-off point is ensured by alternately setting the triggering level to L max  and L min  on each test step of the binary search cycle so that the entire triggering window is scanned. 
     An automatic triggering level may be established for time-varying signals having frequencies which are lower than the low-frequency cut-off point of the instrument in which the automatic signal-level-detecting apparatus is embodied; however, such triggering level may or may not be calculated to be at the 50% point between signal peaks. If the slowly-varying signal is within the trigger window, the comparator will generate transitions which will trip the counters during the searches for peaks and valleys, even though the trigger reference voltage does not match the peak values. However, a level detected while searching for a positive peak is necessarily more positive than a valley. And likewise, a level detected while searching for a valley is necessarily more negative than a peak. Accordingly, these two detected levels may be used in establishing an automatic triggering level at some point therebetween. 
     It will, therefore, be appreciated that the aforemdentioned and other desirable objects have been achieved; however, it should be noted that the particular embodiments of the invention which are shown and described herein are intended as merely illustrative and not as restrictive of the invention.