• Aucun résultat trouvé

BUILDING BLOCK FUNCTIONS-FOUNDATION OF DESIGN

Therefore, the third harmonic is absent, the fifth is down 28db, the seventh is down 34db, etc. This represents a much lower harmonic content than the original sawtooth which contains all harmonics in a ratio p(n) =

.i.

n

The 2920 code for this transformation is given below.

The oscillator, represented by the variable name OSC, is assumed to be a sawtooth between + 1.0 and O. The com-ments indicate the steps the waveform transformation takes. Note the use of a constant KP4 to readjust DC levels.

LDA Y

asc

ROO ; Sawtooth + 1.0 to 0 SUB y KP4 ROO ; Sawtooth + O.S to -0.5 ABS y y LOI ; Triangle 0 to 1.0 SUB y KP4 ROO ; Triangle -O.S to O.S ADD y y LOI ; Clipped Triangle

Example-A program for an oscillator which generates the clipped triangle wave approximation to a sine wave for a frequency of 1070Hz

=

0.1 0/0. Assume a sample interval of 76.8/isec.

The value for K1 may be found by solving the oscillator frequency equation above.

KI

=.!....*

K2 fs

In binary, for 1070Hz ± 1.07 Hz and K2 = 1.0, .0001010100000100 ~ KI ~ .0001010100001110 A value of K1 = .0001010100001 = 2-~+2-6+2-8+2-13 corresponds to 1069.7Hz. The program for the oscillator then becomes as follows:

SUB

asc,

KPS, R03 SUB

asc,

KP4, R07 SUB

asc,

KP4, RI2 LDA DAR,

asc,

ROO

ADD

asc,

KP4, LOI, CNDS ; conditional ADD K2 Note the use of the 2920 constants to generate the desired values for K1, and K2, and the use of the condi-tional ADD to perform the K2 addition, which resets the osciIlator. This code may be followed by that realiz-ing the waveform modification of Figure 4.2 to com-plete the generation of the clipped triangle output.

4-7

4.2.2 Overflow Technique for Relaxation Oscillator

It is possible to generate a sawtooth waveform using the overflow disable operations described in Table 3-4c. In some cases this technique may yield a shorter overall program length. The technique involves using the

"wraparound" characteristics of a non-overflow cor-rected 2's complement number system; that is, if you add 1 to the most positive number, the result will be the most negative number. In its simplest form, a sawtooth or "ramp" may be developed using the following 2920 code:

ABA

asc

KP4 R07 CND(K)

where the ABA with CND(K) instruction disables overflow correction and the non-CND(K) part incre-ments the value OSC by a constant (2-8 in this-example).

4.3 Voltage Controlled Oscillators (VCQ's)

The basic relaxation oscillator described above may be frequency modulated or voltage controlled by replacing K1 with a suitably weighted variable from the control-ling voltage or modulating signal.

If the variable V represents the instantaneous value of the modulating signal and a frequency relationship of the form F = fo + A V is desired, then the algorithm for the oscilfator becomes as follows:

1) At each sample period, subtract the value (fo +AV) K2/fs from the oscillator register.

2) If the register contents become negative, add K2 to the oscillator.

The value (fo+AV)K2Ifs can be separated into constant and variable terms.

constant term = fo K2!fs variable term = AV * K2!fs

Because 2920 realizations of VCO's are sampled, the usual considerations for alias distortion must be made.

The output of the VCO will represent a sampled version of the corresponding continuous signal. Because fre-quency modulation can produce fairly wide side bands (in addition to those due to waveform), this side band energy is a potential source of alias distortion if it has

BUILDING BLOCK FUNCTIONS-FOUNDATION OF DESIGN

significant components above half the sample rate. For this reason, the maximum frequency excursion of the VCO should be kept well below half the sample rate.

4.4 Oscillators Based On Unstable Second-Order Sections

A second order filter with poles on the imaginary axis of the s-plane (unit circle of the z-plane) is predicted to act as an oscillator with a stable sine-wave output. A stage of this type may be used as the basis of a sine-wave oscillator. However, the amplitude of the oscillation is determined by the initial values in the filter, and the slightest deviation of the pole locations can cause the amplitude to grow or decay.

One approach to this type of oscillator is to place the poles so that the oscillation grows slowly with time, with overflow saturation limiting the growth. Many simple LC oscillators operate in this mode. The technique is also applicable to the 2920, but the user must be aware of the differences between continuous (analog) and discrete (digital) oscillators. The continuous oscillator starts because small amounts of noise provide an initial excitation of the unstable pole pair. For example, if the second order section initially has Y 1 = Y2 = 0, the stage will provide zero output rather than oscillations, unless it is excited by some external input.

To prevent such a degenerate solution, it may be necessary to measure the oscillator amplitude, and

"strike" the oscillator to start it. The amplitude measure may be obtained by low-pass filtering the rec-tified output, with striking being accomplished by mak-ing X = 0 if and only if the amplitude exceeds some minimum value.

The equations for an oscillator are similar to those of a second order filter. If the oscillator frequency and growth should be of the form

A . eat sin (bt) oscillations grow in amplitude. Larger values cause

4-8

faster starting, but at the expense of frequency accuracy. In addition, overflow saturation may produce undesirable effects on oscillator behavior. Each time saturation is entered the oscillator behaves as if a small quantity was added to YO. Such a change corresponds to a change in both amplitude and phase. The amplitude change may introduce undesired harmonic content and the phase change may result in a change of frequency, sequence of output samples then repeats indefinitely.

When a particular state is periodically forced by the occurrences of overflow saturation, the length of the repetition period may be shortened considerably, with the effect that the oscillator frequency fosc, takes the form: fosc=(KlIK2)fs. In the equation, K2 represents the number of samples in one repetition, and Kl represents the number of cycles of the oscillator in that period. The sample rate is designated fs. The harder the oscillator "hits the stops", i.e., the larger the value of

"a", the shorter the repeat cycle will be. Actual eval-uation of repeat cycle length, etc., is probably best achieved by computer simulation.

4.5 Gain Controlled Oscillator

The oscillator described above is equivalent to a con-tinuous positive feedback oscillator, in which oscilla-tions grow until the loop gain is reduced by amplifier saturation. Another type of continuous oscillator uses gain control to determine oscillator amplitude. An early realization of a gain controlled continuous oscillator used an incandescent lamp in the positive feedback loop. A rising amplitude heated the lamp filament, rais-ing its resistance and reducrais-ing the oscillator's positive feedback.

An equivalent oscillator realized with the 2920 will con-sist of an amplitude measurement, with the value of

"a" (in the equations for Bl and B2) being a function of the amplitude. A positive "a" causes the oscillation amplitude to rise, while a negative value produces a fall-ing amplitude.

Normally both Bl and B2 must be varied, but it is possi-ble to limit the variation to B2 if a small frequency variation is tolerable. In this mode Bl is fixed at a value

BUILDING BLOCK FUNCTIONS-FOUNDATION OF DESIGN

nominally equal to 2·cos(bT). When the amplitude is below the desired value, B2 is set to equal to -(1 +E) where E is a small positive number. Otherwise B2=-(l-E). The oscillator operates alternately at the frequencies fo+b.f and fo-b.f, where fo=bl2rr and b.f=E/(4rrT· tan(bT». If more precise frequency control is needed, .Bl may also be adjusted whenever B2 is modified.

4.6 Realization Of Non-Linear Functions There are five sources of non-linear operations in the 2920: absolute magnitude (ABS), signum or limit (LIM), conditional arithmetic, logical operations, and overflow.

Non-linear operations may be used to simulate analog non-linearities using piecewise linear approximations, and may also be used for relaxation oscillators, modulators, automatic gain control, etc.

The range of possible non-linear functions is very broad, but a number of examples are given below to illustrate the capabilities of the 2920.

Note: One caution must be observed when implement-ing non-linear functions in a sampled system such as the 2920. Because non-linear functions may produce signals rich in harmonics, the output samples of a signal pro-duced by a non-linear function may be equivalent to samples of a non band-limited signal. Some of the har-monics may beat with the sample frequency to produce unexpected alias distortion components. Even though input and output of both the sampled system and its analog counterpart may be band-limited, there may be differences between them when non-linear functions are simulated.

4.6.1 Simulation of Rectifiers

The absolute magnitude function, Y =

I

X

I,

can be realized with a single 2920 instruction (ABS). This func-tion behaves as an idealized full-wave rectifier. The add absolute function (ABA) is useful for combining full-wave rectification with input to a filter.

Half-wave rectifiers can be realized using the equation y = (x +

I

x

I )

12. The corresponding 2920 code for this operation is as follows:

LDA Y, X, ROl; Y = X/2

ABA Y, X, ROl; Y = XI2 + ABS(X)12

4-9

Other rectification characteristics may be simulated using piecewise linear approximations or multiplication and/or division.

4.6.2 Simulation of Limiters

Limiters may be realized in three ways using the 2920;

via the LIM function, via overflow, or by calculations using absolute magnitudes (ABS, ABA operations).

The LIM function produces an ideal threshold logic ele-ment. Even the smallest signal forces a full positive or negative output.

In some systems, signals below some level should not be allowed to excite limiting. These systems require a transfer characteristic similar to that shown in Figure 4-3, where signals with amplitude below the threshold

"a" do not produce full scale output. This type of limiter characteristic can be realized using overflow saturation or with the use of absolute magnitude functions.

To use overflow saturation to implement such a limiter, the value X is loaded to Y with a left shift code, after which Y may be loaded or added to itself with addi-tionalleft shifts. Consider the sequence below:

LDA Y, X, L02; Y = 4*X ADD Y, X, L02; Y = 5*4*X = 20*X

The effect is to generate a value of Y which is 20 times X. If X exceeds a value of 0.05, Y will be held to + 1.0, or if X ~ - .05, Y will take the value -1. Thus the characteristic realized is that of figure 4-3 with a = 0.05, and L = 1.0.

OUTPUT

1/

_ _ _ _ _ - - J -L

INPUT

Figure 4·3. Limiter Transfer Characteristic

BUILDING BLOCK FUNCTIONS-FOUNDATION OF DESIGN

Another realization can be based on the equation LOA T, X, ROO;

SUB T, A, ROO; X-A in T y =

I

x-a

I - I

x+a

I

ABS Y, T, ROO; Y=ABS(X-A) which realizes the same shape curve as that of Figure ADD T, A, LOI; X+A in T 4-3, with a value of L = 2a. This form generally takes ABS T, T, ROO; ABS (X+A) in T more steps than the overflow saturation method, but

SUB Y, T, ROO; Y = ABS( X-A) - ABS( X+A) allows greater freedom in setting parameters. The 2920

code might appear as follows, where A represents the limiter threshold, and T is a location used only for intermediate calculations:

4-10

Summary of 5