oscillator works. The synthesized oscillator uses NXP
Semiconductors’ (formerly Freescale and before that
Motorola) eight-bit MC9S08SE4 microcontroller.
This processor contains an index register called ‘h:x’
where h and x are independent eight-bit registers. (The
semicolon between h and x indicates that these registers
are concatenated. They are read as one 16-bit register,
even though they are two independent eight-bit registers.)
They are used to point to locations in memory that
contain a sine wave lookup table.
In our case, h:x has been chosen to start at $f300 (‘$’
means a hex number) and end at $f3ff. The h register
remains fixed at $f3, and the x register cycles through 00,
01, 02,…FE, FF, 00, 01, etc. Each memory location contains
a point on the sine wave. There are 256 points (0-255),
and each step is 360/256 = 1.40625 degrees. A table of
memory locations is shown in Figure 4A.
The amplitudes in the table are calculated from the
Sine Wave Amplitude = 128 + 127sin(1.40625 x N) with
For example, for N=0, Amplitude = 128 (angle = 0
N= 64, Amplitude = 255 (angle = 90 degrees)
N=128, Amplitude = 128 (angle = 180 degrees)
N=192, Amplitude = 1 (angle = 270 degrees)
This represents a sinusoid with a zero line of 128, a
positive peak of 255, and a negative peak of 1.
For purposes of this discussion on the basic operation
of the oscillator, it is important mainly to understand that
cycling through the x register points to a complete sine
wave cycle. We are now ready to understand the oscillator
as represented in the flow chart of Figure 4B.
Assume for the moment that the Wait time is zero (no
wait). The fastest possible sine wave (for this processor
and this software) will occur. A point on the sine wave will
be sent to the D/A (digital-to-analog) converter. The X
register will be incremented to the next point in memory.
It will be sent to the D/A converter and so on. The X
register will race around from $00 to $FF repeatedly,
thereby repeatedly describing complete cycles of sine
waves at the output.
Now, suppose we introduce a Wait time of exactly
65.10416667 microseconds (how to get this exact delay
will be told momentarily). Each new point on the sine
42 April 2017
Memory Location Sine Wave Amplitude
$f300 Amplitude for N=0
$f301 Amplitude for N=1
$f302 Amplitude for N= 2
$f303…$f3fc N= 3 to N=252
$f3fd Amplitude for N=253
$f3fe Amplitude for N=254
$f3ff Amplitude for N=255
FIGURE 4A. Memory contents per memory
Read the number pointed to by the X
register and send it out to the D/A
Read the number pointed to
by the X register and send it
out to the D/A
Flow chart of