3 operational description, 1 melody generator, 3 op – Toshiba H1 Series User Manual
Page 595: 1 melod

TMP92CZ26A
92CZ26A-592
3.22.3 Operational
Description
3.22.3.1 Melody
generator
The Melody function generates signals of any frequency (4Hz-5461Hz) based on
low-speed clock (32.768KHz) and outputs the signals from the MLDALM pin.
By connecting a loud speaker outside, Melody tone can easily sound.
(Operation)
At first, MELALMC
as output waveform from MLDALM. Then melody output frequency has to be set to 12-bit
register MELFH, MELFL.
Followings are setting example and calculation of melody output frequency.
(Formula for calculating of melody waveform frequency)
@fs
= 32.768 [kHz]
Melody output waveform
f
MLD
[Hz]
= 32768/ (2 × N + 4)
Setting value for melody
N
= (16384/ f
MLD
)
− 2
(Note: N
= 1~4095 (001H~FFFH), 0 is not acceptable)
(Example program)
In case of outputting “A” musical scale (440Hz)
LD
(MELALMC),
−−XXXXX1B ; Select
melody
waveform
LD
(MELFL),
23H
;
N
= 16384/440 − 2 = 35.2 = 023H
LD
(MELFH), 80H
;
Start to generate waveform
(Refer: Basic musical scale setting table)
Scale Frequency
[Hz]
Register
Value: N
C 264
03CH
D 297
035H
E 330
030H
F 352 02DH
G 396
027H
A 440
023H
B 495
01FH
C 528
01DH