Sound Generator Operation; Generating The Tone - NEC V850E/Dx3 Preliminary User's Manual

32-bit single-chip microcontroller
Table of Contents

Advertisement

Sound Generator (SG)
Downloaded from
Elcodis.com
electronic components distributor

24.3 Sound Generator Operation

This section explains the details of the Sound Generator.

24.3.1 Generating the tone

The tone signal is generated by the compare match signal of the SG0FH
counter value with the value of the SG0FH buffer, followed by a by-two-divider.
At each compare match, the counter is reset to zero.
Remember that the SG0FH counter is clocked by the output of the SG0FL
counter.
(1)
Updating the frequency buffer values
The values of the frequency buffers can be changed by writing to the
associated frequency registers SG0FL and SG0FH. Both registers can be
written together via SG0F.
Changing the value of the SG0FL (equivalent to SG0F[15:0]) register would
also yield a change of the PWM frequency, i.e. the sound volume. Therefore it
is obligatory to write the correct PWM value to SG0PWM before a new SG0F
value is copied to the frequency buffers.
The SG0F register contents is copied to the buffers when the following
sequence is detected:
1. CPU write access to SG0PWM register occurred.
2. SG0FH counter value and SG0FH buffer value have matched.
This match is equivalent to the next edge (rising or falling) of the tone
signal.
The following figure shows an example (not to scale).
SG0CLK
SG0F
003B 01AE
(32 bit)
H
(Step 1)
Write
SG0PWM
SG0FH
buffer
SG0FH
compare
match
SG0FH
038
H
counter
Figure 24-3
Update timing of the frequency buffers
Up to the next match, frequency registers and associated buffers can hold
different values. If a 309 Hz tone is generated, as in the above example, the
time span between writing to the SG0PWM register and updating the buffer
can be up to 3.24 ms.
Preliminary User's Manual U17566EE1V2UM00
0027 01AE
H
003B
H
(Step 2)
039
03A
03B
000
H
H
H
Chapter 24
0027
H
001
H
H
849

Advertisement

Table of Contents
loading

Table of Contents