04.03.2013 Views

RL78/D1A User's Manual: Hardware - Renesas

RL78/D1A User's Manual: Hardware - Renesas

RL78/D1A User's Manual: Hardware - Renesas

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Under development<br />

Preliminary document<br />

Specifications in this document are tentative and subject to change.<br />

<strong>RL78</strong>/<strong>D1A</strong> CHAPTER 17 SOUND GENERATOR<br />

17.3 Sound Generator Operation<br />

This section explains the details of the Sound Generator.<br />

17.3.1 Generating the tone<br />

The tone signal is generated by the compare match signal of the SG0FH counter value with the value of the SG0FH<br />

buffer, followed by a by-two-divider. At each compare match, the counter is reset to zero.<br />

Remember that the SG0FH counter is clocked by the output of the SG0FL counter.<br />

(1) Updating the frequency buffer values<br />

The values of the frequency buffers can be changed by writing to the associated frequency registers SG0FL and<br />

SG0FH.<br />

Changing the value of the SG0FL (equivalent to SG0F[15:0]) register would also yield a change of the PWM<br />

frequency, i.e. the sound volume. Therefore it is obligatory to write the correct PWM value to SG0PWM before a new<br />

SG0FL value is copied to the frequency buffers.<br />

The following figure shows an example (not to scale).<br />

SG0CLK<br />

SG0FH<br />

Write<br />

SG0PWM<br />

SG0FH<br />

buffer<br />

SG0FH<br />

compare<br />

match<br />

SG0FH<br />

counter<br />

003B H<br />

Figure 17-5. Update Timing of the Frequency Buffers<br />

038 H<br />

003B H<br />

039 H<br />

03A H<br />

If SG0FL is set to 01AEH and a 193 Hz tone is generated, as in the above example, the time span between writing to<br />

the SG0PWM register and updating the buffer can be up to 5.17 ms.<br />

R01UH0317EJ0004 Rev. 0.04 1006<br />

Feb. 22, 2013<br />

0027 H<br />

03B H<br />

000 H<br />

0027 H<br />

001 H

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!