In Mixed-Signal Circuits, Part 1: From *s* to *z* – The Discrete Complex-Frequency Domain , discrete-time analog circuit analysis introduced the *z* -domain, a simple shortcut from discrete time-domain equations to the sampled *s* , or *s* *-domain. In this part, we push forth to transfer functions in *s* and *z* of ADCs and DACs, then consider briefly how to design feedback loops that span the analog-digital boundary.

Part 1 left us hanging as to how impulse trains relate to discrete-time waveforms. The development continues, and in the concrete context of ADCs, so that the abstraction of impulses can have a clearer meaning.

**ADC Dynamics in z **

To demonstrate how the *z* -domain can be applied in circuit engineering, a 12-bit ADC transfer function is

where *v _{ADC} * is the input voltage,

*V*is the full-scale 3.3 V ADC reference voltage, and

_{R}*w*is the 12-bit ADC output. This ADC transfer function is quasistatic; it applies at 0+ Hz. The ADC dynamics of the clock-sampled

_{ADC}*zero-order hold*(ZOH) output accounts for the sampling behavior of the ADC. The sampler, which produces the impulse trains from Part 1, is followed conceptually by a hold function,

The right-side expression can be interpreted as the gain-normalized integration (1/*s* x *T _{s} * ) of an impulse train in the time domain, resulting in a sequence of step functions, each turned off

*T*later (− exp(−

_{s}*s*x

*T*)) so that their effect only occurs over one sample interval. At each sample time, a new value of ADC output is acquired and held. Plotted against time, this waveform has the stair-step look of a sample-and-hold waveform described by

_{s}*T*(

_{ZOH}*s*), as shown below.

The acquired continuous voltage waveform, *v _{i} * (

*t*), is plotted along with its

*piecewise-continuous*or “stepped” digital output, approximated as the continuous

*v*(

_{o}*t*), shown as a dotted curve. This approximation of the acquired waveform is reconstructed by shifting the continuous waveform,

*v*, by

_{i}*T*/2 to the right, a delay of a half sampling period. It passes through the centers of the vertical steps of the acquired ZOH waveform.

_{s}The ADC sample-hold frequency response is the magnitude and phase of *T _{ZOH} * (

*j ω*);

The main step in this derivation is to multiply numerator and denominator by * e ^{-jω Ts } * /2, then apply (from Euler’s equation,

*e*= cos

^{j θ }*θ*+

*sin*

*θ*, where*θ*=*ω*x*T*/2),_{s}

The amplitude of *T _{ZOH} * (

*j ω*) is thus

This function begins with a value of one at zero frequency ( *ω * = 0 s^{–1} ) and decreases to zero at the sampling frequency. Then it “bounces” (because of the absolute value) between zero values at harmonics of *f _{s} * , outside the Nyquist interval. The rolloff of magnitude with frequency can be compensated with an inverse ZOH (ZOH

^{-1}) function and can be included following the ADC block as code in the μ C. It can be omitted if the ADC sample rate is enough above the analog-circuit bandwidth to make amplitude roll-off and phase delay insignificant so that the sampled result is approximately continuous.

The phase is

In degrees, the phase is −180^{o} (*f* /*f _{s} * ), where

*f*= 1/T

_{s}_{s}. The T

_{s}/2 delay in the phase is the half-step of delay observed graphically in the plot above of

*v*delayed from

_{o}*v*.

_{i}At the Nyquist frequency, *f _{s} * /2, the magnitude will have decreased to (sin( π /2))/( π /2) = 2/ π ≈ 0.637 with a phase delay of −180

^{o}/2 = −90

^{o}. A sampling rate of 10 times

*f*results in a normalized amplitude of 0.9836, with about 6 bits of accuracy. Some values are given in the following table.

_{s}We arrive at the final step, the ZOH function, which completes the transformation from *z* to *s* :

Thus, to transform from *z* to *s* , substitute *z* (*s* ) = exp(*sT _{s} * ) for

*z*, then multiply the resulting impulse-train or sampled expression in

*s*by the ZOH function.

*
*

**Discrete-Time Control in w **

There is a way (yet another transform) which avoids the complication of doing control analysis in *z* . Then *z* is used only as a quick way to get from discrete *t* to *s* *. Control design of feedback loops can be worked out as though the feedback system were continuous, then convert to the discrete domains using the *bilinear transform* , *w* (*z* ), to account for sampling effects. We now have four domains: *t* , *s* , *z* , and *w* . The *w* -transform maps the left half-plane of *s* onto the unit circle of *z* so that whatever is stable in *s* is stable in *z* (within the unit circle) and *t* and whatever is unstable in *s* is unstable in *z* and *t* . The new quantity, *w* , has units of frequency and behaves more like *s* than *z* , which is unitless. Stability analysis in *s* applies to *w* . Indeed, *w* ≈ *s* ;

As 1/*s* T_{s} is a continuous integrator in *s* , 1/*w* T_{s} is a trapezoidal integrator in the time domain. If *w* (*z* ) were inverse-*Z* transformed from *z* to *t* , it would be a trapezoidal integrator, what in numerical analysis (which, by the way, is equivalent to DSP, expressed more in mathematical than engineering language) is Euler’s integration rule; the two endpoints of an interval to be integrated are averaged in value and multiplied by the time interval, *T _{s} * .

Because the pole and zero values of *s* are only approximately the same in *w* , to accurately transform *s* -domain poles and zeros to the *w* -domain, a *prewarp transform* is applied to them. The relationship between *s* = *jω* and *w* = *jω _{x} * is found by recalling the defining relationship between

*s*and

*z*;

Then for *s* = *j ω * ,

Substitute this into the *w* (*z* ) transform;

Then the *s* -domain steady-state frequency, *ω* , is related to its corresponding frequency in *w* of *ω _{w} * by

The desired poles and zeros of a continuous function of *f* can be *prewarped* to *f _{w} * values before applying frequency-response analysis by substituting the

*f*pole-zero values into the

_{w}*s*-domain transfer function. The following table gives some prewarp values.

where *f _{w} * =

*ω*/2 π , and

_{w}*ω*is the

_{w}*w*-domain approximation to

*ω*of

*s*=

*jω*. As the sampling ratio

*f*/

_{s}*f*increases,

*f*in

*s*approaches

*f*in w. As

_{w}*f*/

_{s}*f*approaches the Nyquist-frequency value of 2, the ratio of steady-state

*w*to

*s*decreases and the frequencies diverge. At a sampling rate 10 times the

*s*-domain

*f*, the error in the corresponding discrete-time frequency is about −3.3 %. At this ratio of 10, the sample frequency,

*f*is often high enough that the difference between continuous- and discrete-frequency poles and zeros is negligible, and prewarping can be omitted.

_{s}**From z to Discrete-Time Equations**

To illustrate the use of the *w* -domain, a common motor-drive feedback-loop compensator is the PID transfer function, *y* (*z* )/*e* (*z* ), from Part 1, where *e* is the feedback-loop input error, implemented here by converting to the *z* -domain the three terms of

Substituting *w* (*z* ) for *s* and simplifying,

This can be solved for the outputs of *y* (*z* ) by first rewriting

to express the *z* quantities as delays of one sampling cycle or computed iteration, *z* ^{–1} . Then

The time-domain difference equations to be implemented in computer code follow by applying (apart from initial conditions) the time-shifting transform from *z* to discrete-time *t* = *nT _{s} * :

For *y _{D} * (

*z*), conversion from the

*z*-domain to the discrete time-domain of computer code is

For the remaining two terms,

where in general, *x* (*n* − *k* ) is the *k* th previous sample point of *x* from the *x* (*n* ) of the *n* th sample point and iteration that is presently being computed. These three difference equations can be implemented directly in software, keeping in mind that if *n* corresponds to the present iteration of the computation loop in time, then the *n* − 1 samples are from the previous iteration last time through the loop. The combined output, *y* (*z* ), is the sum of the three outputs. Usually, these iterations of *y* (*n* ) computations are implemented as interrupt-driven by a timer that produces regular *T _{s} * intervals.

If the *f _{s} * /

*f*ratio is high enough – often ≥ 10 – then

*ω*and

_{p}*ω*do not need to be pre-warped. Otherwise, apply the prewarp formula of the

_{z}*w*-domain to more accurately position the pole and zero in the

*s*-domain.

**Summary**

The *z* discrete-sequence and *w* discrete-frequency domains add some further complication to electronics that take sampling into account. Happily, mastery of the different rules of dynamics in the *z* -domain can be largely avoided by using it as a shortcut between the discrete-time and sampled-frequency domains. If design values of poles and zeros in *s* for loop frequency compensation are to be implemented in the μ C, then the *w* -domain is another shortcut in that *w* is an approximate, sampling-affected *s* . Prewarping from *s* to *w* and using the bilinear formula of * ω _{w} * result in

*z*-domain transfer functions that are then directly converted (as

*z*→

^{–n}*x*(

*t*–

*n T*)) to discrete-time equations and computer code.

_{s}As μ C-based systems continue to proliferate, *digital signal processing* and *discrete control* have become commonplace and an essential part of the electronics engineering body of knowledge. The concepts of this brief tutorial on discrete-time circuit analysis – of sampling by ADCs and DACs – is an increasingly important and familiar part of the working knowledge of the analog engineer of mixed-signal electronics.

*
*

## 0 comments on “Mixed-Signal Circuits, Part 2: ADC and DAC Dynamics, the w-Domain, and Feedback Loop Design”