![](http://datasheet.mmic.net.cn/330000/M34116_datasheet_16432742/M34116_11.png)
M34116 INSTRUCTION SET
(continued)
INSTRUCTION 5: M34116 TONE GENERATION
Up to 7 Tone and 1 Melodychannels may be activesimultaneously. The instruction format for Tone and
Melody is the same. For each Tonechannel from 1 up to 4 couples of Step/Timemay be specified while
for the Melodychannel from 1 up to 32 couplesof Step/Time maybe specified.
Note:
The Melody channelcan be channel 0 or 8 or 16 or 24 etc. accordingto the followingformula:
Melodychannel number = 0 + 8
x
n (n = 0, 1, 2, 3, 4, 5, 6, 7)
The Tone channel assignment follows the same rule:
Tone 1 channelnumber = 1 + 8
x
n (n = 0, 1, 2,3, 4, 5, 6, 7)
Tone 2 channelnumber = 2 + 8
x
n (n = 0, 1, 2,3, 4, 5, 6, 7)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tone 7 channelnumber = 7 + 8
x
n (n = 0, 1, 2,3, 4, 5, 6, 7)
This means that, selecting the tone 1 on the channel 9 (or and other one of its series), the channels 1,
17, 25.... can not be usedfor tones (or melody). The same is occuring for the tones2...7 or the melody.
Control Signal
RD
1
1
1
1
1
1
1
:
Data Bus
D4
AO4
C4
CS
0
0
0
0
0
0
0
:
C/D
0
0
1
0
0
0
0
:
WR
0
0
0
0
0
0
0
:
D7
D6
D5
D3
AO3
C3
1
S13
T13
S23
T23
:
D2
AO2
C2
1
S12
T12
S22
T22
:
D1
AO1
C1
0
S11
T11
S21
T21
:
D0
AO0
C0
0
S10
T10
S20
T20
:
S17
T17
S27
T27
:
S16
T16
S26
T26
:
S15
T15
S25
T25
:
S14
T14
S24
T24
:
optionalend code:
0
1
0
0
1
1
1
1
1
1
1
1
opcode:
0
1
1
0
1
1
0
0
O
AO4–AO0:Output attenuationor gain (
±
15dB) AO4 = 1 gain, AO4 = 0 attenuation,
AO3–AO0value in dB (0–15)
0dB attenuationor gaincorrespond to -6dBm0 level.
O
C5–C0:Channelnumber (0–63)
O
Sn7–Sn0:FrequencyStep for the n–thnote in the tonesequence (n = 1–4 for tone n = 1–32 for
melody). Step is a compressedcoding of the frequencyvalue. Given a frequencyvalue f the value of
S7–S0can be calculatedas follow:
1) calculate the linearstep SL = round ( f
x
32
125)
2) apply the followingtable to get S7–S0value from SL value (see also Appendix1A and 1B).
S7
0
0
0
1
1
S6
0
0
1
0
1
Linear Step SL value (10 bit)
0
S5
1
S5
S5
S4
S4
S3
S3
S2
(SL decimal)
(1
→
64)
(*)
(65–>127)
(**)
(128–>254)
(256–>508)
(512–>1008)
STEP (Hz)
3.9
3.9
7.8
15.6
31.2
0
0
0
0
1
0
0
0
1
0
0
1
S4
S4
S3
S2
S1
S3
S3
S2
S1
S0
S2
S2
S1
S0
0
S1
S1
S0
0
0
S0
S0
0
0
0
S5
S4
S5
(*)
For tone 7 only;
(**)
For melodyand tone 1-6
Note: to obtain a Pause (Silence) –> S7–S0 must be all 0’s
O
Endcode: if Less than 4 couplesof Step/Timefor toneor less than32 formelody are to be specified
thenafter the last coupleof Step/Timea Step of all 1’s (optional end code) must be sentbefore the
opcode. Otherwise it mustbe skipped.
O
Tn7–Tn0:Specify the duration of the n’th note or pause. The time increment is 32ms. To get T7–T0
value, divide the wanted duration in ms by 32 and round to integer.
Note: The minimum time between rising edges of successiveWR for tone generationinstruction is 4ck
periods(6ck periods if EC = 1).
M34116
11/23