![](http://datasheet.mmic.net.cn/300000/T9000_datasheet_16218596/T9000_97.png)
Lucent Technologies Inc.
97
Preliminary Data Sheet
November 2000
ISDN Network Termination Node (NTN) Device
T9000
12 PWM Module
(continued)
12.4 PWM Auto Mode Example
Consider an example of how to set up the PWM mod-
ule in auto mode. Suppose we want to generate a sine
wave of frequency Fs. First select the values of range
and granularity, and then compute the appropriate
value of PWxVH/L. To accomplish this, the procedure
is as follows:
Calculate the pulse period, PP, (from equation 2)
PP = Range x Granularity x 65 ns
(3)
Calculate the sine period, SP:
F
SP =
(4)
Based on PP and SP, we can calculate the number of
samples (Ks) per sine period:
PP
Range
Granularity
×
Ks =
=
(5)
Now calculate the 16-bit quantity PWV (i.e., PWVxH/L,
the amount by which the accumulator will increment
each time as shown in Figure 22). There are 2
16
total
addresses in one sine period, SP. Since there are Ks
samples in one sine period, 2
16
must be divided by Ks
so that exactly one cycle of all 2
16
addresses has been
completed in one sine period, SP. The rounded result is
PWV, which gets written into the PWxVH and PWxVL
registers:
16
K
S
16
------------------------------------------------------------------------------------------------------
PWV = ROUND
=
ROUND
(6)
Now, back-calculate the actual number of samples (Ka)
based on the rounded result:
16
PWV
Ka =
(7)
To find the error in frequency due to rounding, first
back-calculate the actual frequency of the sine modula-
tor output by taking the inverse of the pulse period
times the actual number of samples, as follows:
Fa =
(8)
Then calculate the error in frequency as:
Ferr =
x 100%
(9)
To further understand the operation of the PWSM mod-
ule, consider the math behind the operation. The sine
wave being generated can be described by the follow-
ing equation:
f(t) = Asin (2
π
x Fa x t)
(10)
where Fa is computed per equation 8. A new value for
this equation is computed every pulse period, PP.
Therefore, in the nth pulse period (where nis an inte-
ger representing the current sample number, beginning
with sample 0), the time (t) in the above equation is:
t = n x PP
(11)
Substituting equation 11 into equation 10 yields:
f(t) = Asin (2
π
x Fa x n x PP)
(12)
Now rearranging equation 8,
PP =
(13)
and substituting the value of Ka computed in equation
7 results in:
PP =
(14)
Substituting equation 14 into equation 12 yields:
f(t) = Asin (2
π
)
(15)
From equation 15, it is evident that the argument gen-
erated sine wave is n x PWV. This term is generated at
the output of the accumulator shown in Figure 22 by
clocking the accumulator at PP intervals. The maxi-
mum value of n x PWV is 2
16
because the accumulator
will roll over after it reaches 2
16
. Therefore, the factor of
2
16
in the denominator is the normalization factor,
which is equal to the maximum value of n x PWM.
------
--------
65 ns
×
--------------------------------------------------------------------------------------
---------
SP
---------------
×
PP
Ka
-----------------------
---------------------
S
F
S
×
Fa
Ka
----------------------
Fa
2
16
×
-----PWV
n
PWV
2
16
×