Toshiba H1 Series Data Book page 595

32bit micro controller tlcs-900/h1 series
Table of Contents

Advertisement

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<MELALM> have to be set as "1" in order to select melody waveform
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)
Melody output waveform
Setting value for melody
(Note: N = 1~4095 (001H~FFFH), 0 is not acceptable)
(Example program)
In case of outputting "A" musical scale (440Hz)
(Refer: Basic musical scale setting table)
Scale
(MELALMC), −−XXXXX1B
LD
LD
(MELFL), 23H
LD
(MELFH), 80H
Frequency
[Hz]
C
264
D
297
E
330
F
352
G
396
A
440
B
495
C
528
92CZ26A-592
@fs = 32.768 [kHz]
[Hz] = 32768/ (2 × N + 4)
f
MLD
N = (16384/ f
) − 2
MLD
; Select melody waveform
; N = 16384/440 − 2 = 35.2 = 023H
; Start to generate waveform
Register
Value: N
03CH
035H
030H
02DH
027H
023H
01FH
01DH
TMP92CZ26A

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tlcs-900Tmp92cz26axbg

Table of Contents