APLUS API4000M4

INTEGRATED
CIRCUITS INC.
„
API4000M
SERIES
VOICE OTP MODULE
GENERAL DESCRIPTION
API4000M is a 4-channel Sound Generator which consists of Melody-Controller and Micro-Controller.
API4000M can directly drive Speaker by the Power Amplifier inside, It has 12 I/O Ports connect with other units.
API4000M give 24Bit parallel Address Bus and 8Bit parallel Data Bus for connecting with the Memory from
outside, it can process data maximum 128M bits, it commendatory apply to the product which use high quality
voice and music synthesizer.
„
FEATURE
*. 4-channel Sound Generator with Melody
*. VCC = 2.7V ~ 5V
*. 4bit ADPCM
*. 24bit Address Bus, 8bit Data Bus
*. 42 Instruction Set
*. 12 Input/Output Data Port
*. Built-In Power Amplifier
PART
NO.
VOICE
API4000M2
API4000M4
API4000M8
DURATIONS
22 min.
44 min.
88 min.
25mm
42mm
1
Ver1.1
API4000M
INTEGRATED
CIRCUITS INC.
SERIES
VOICE OTP MODULE
„ ABSOLUTE MAXIMUM RATING
Supply Voltage ( VDD to GND )
------------------
5V
Input Voltage Range
------------------
(GND- 0.3V) to (VDD + 0.3V)
Operating Temperature Range
------------------
0℃ to +60℃
„ ELECTRICAL CHARACTERISTICS
( VDD=4.5V , GND=0V ,Ta=+25℃ , unless otherwise noted )
PARAMETER
CONDITIONS
Standby Current
Chip Shut Down
Operating Current
Sound On 8 ohm Speaker
Input low voltage
Input Pins exclude AmpIn
Input high voltage
Input Pins exclude AmpIn
MIN
MAX UNITS
10
50
3.2
Iout = -0.1mA for Output Pins
output high voltage
Iout = 0.1mA for Output Pins
V
V
0.5
3.8
uA
mA
0.8
output low voltage
„
TYP
V
V
PIN DESCRIPTION
NO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Pin Name
VDDD
VDDA
GNDD
GNDA
AMPOUT
AMPIN
OSC1
OSC2
PI3
PI2 ~ PI0
PIO3 ~ PIO0
PO3 ~ PO0
CEN
OEN
D7 ~ D0
A23 ~ A0
Description
Digital Positive Power Supply
Analog Positive Power Supply
Digital Negative Power Supply
Analog Negative Power Supply
Power Amplifier Output
Power Amplifier Input
Oscillator Input
Oscillator Output
Data Input Pin
Data Input/Output Pins
Data Input/Output Pins
Data Output Pins
Memory Chip Enable Pin , Low Active
Memory Data Out Enable Pin , Low Active
Memory Data Input Pins
Memory Address Output Pins
2
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
Functional Description
„
A. Micro–Controller
The Micro-Controller inside API4000M is a 8Bit Processor, it has 2 groups Data Bank each has 16 X 8
Bit Register, the Function for processing Data: Addition , Subtraction , logical AND , Moving , Shift and
the other Basic Function. It also has Address Jump , Data Input , Data Output , Sound Control , Melod
yControl and the other Advanced Function.
Here is the list of 42 instruction in API4000M, each instruction has its Format and Description.
1. JUMP
Instruction Format
JUMP INTR1, Pn ﹔
Code
Cycle
Bytes
Instruction Description
01
2
3
if INTR1 = 1, Program Address(PC) will jump to Pn.
JUMP
INTR2, Pn ﹔
02
2
3
if INTR2 = 1, Program Address (PC)will jump to Pn.
JUMP
INTR3, Pn ﹔
03
2
3
if INTR3 = 1, Program Address (PC)will jump to Pn.
JUMP
INTR4, Pn ﹔
04
2
3
if INTR4 = 1, Program Address(PC) will jump to Pn.
JUMP
ADDR, Pn ﹔
05
2
3
Program Address(PC) direct jump to Pn.
JUMP
CO0, Pn ﹔
06
2
3
if carry out = 0,Program Address(PC) will jump to Pn.
JUMP
CO1, Pn ﹔
07
2
3
if carry out = 1,Program Address(PC) will jump to Pn.
PS :
(1). Code : Code of instruction.
(2). Cycle : Time to executive instruction, 1Cycle = 64 clock period.
(3). Bytes : Size of instruction, 1 Byte = 8 Bits.
(4). Pn ﹕Address in Program, e.g. P123;n = 0 ~ 9999.
(5). INTR1 ﹕Key In signal.
(6). INTR2 ﹕Song End signal.
(7). INTR3 ﹕Sound End signal.
(8). INTR4 ﹕Change Instrument signal.
2. Register & Data
Instruction Format
Code
Cycle
Bytes
Instruction Description
ADDC
Rn, Data ﹔
6n
1
2
The value of Rn adds Data,only set Carry but don’t
change the value of Rn. ( Rn + Data ÎC=?)
ADDD
Rn, Data ﹔
7n
1
2
Rn ÍRn + Data
ANDD
Rn, Data ﹔
4n
1
2
The value of Rn logical AND Data,set the solution
to Rn. ( Rn Í Rn AND Data)
MOVD
Rn, Data ﹔
5n
1
2
set Rn Í Data.
SUBDC
Rn, Data ﹔
En
1
2
The value of Rn subduct Data, only return Carry
but don’t change the value of Rn.(Rn-DataÎC?)
Fn
1
2
Rn Í Rn - Data
SUBD
Rn, Data ﹔
PS :
(1). Rn ﹕Number of Register,e.g. R3;n = 0 ~ 15.
(2). Data ﹕a decimal value during 0 ~ 255.
3
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
3. Single Register Operation
Instruction Format
Code
Cycle
Bytes
Instruction Description
SHIFTL
Rn ﹔
2n
1
1
Each Bit of Rn Shift to left Bit,shift 0 to D0.
i.e. D7←D6←D5←D4←D3←D2←D1←D0←0.
SHIFTR
Rn ﹔
3n
1
1
Each Bit of Rn Shift to right Bit,shift 0 to D7.
i.e. 0→D7→D6→D5→D4→D3→D2→D1→D0.
DEC
Rn ﹔
An
1
1
The value of Rn subduct 1,set the solution to Rn. (RnÍRn-1)
INC
Rn ﹔
Bn
1
1
The value of Rn add 1,set the solution to Rn.(RnÍRn+1)
4. Operation between two Registers
Instruction Format
ADDR Rn, Rm ﹔
Code
Cycle
Bytes
Instruction Description
D0
2
2
Rn add Rm, set the amount to Rn..(Rn,ÍRn+Rm)
ADDRI
Rn, Rm ﹔
D1
2
2
Rn add Rm and Carry, set the amount to Rn. (RnÍRn+Rm+C)
ADDRC
Rn, Rm ﹔
D2
2
2
Rn add Rm, only set Carry but don’t change the value
of Rn and Rm. (Rn+Rm Î C?)
SUBR
Rn, Rm ﹔
D4
2
2
Rn subduct Rm, set the difference to Rn. (Rn,ÍRn-Rm)
SUBRI
Rn, Rm ﹔
D5
2
2
Rn subduct Rm and Carry, set the difference to Rn.
(Rn ÍRn-Rm-C)
SUBRC
Rn, Rm ﹔
D6
2
2
Rn subduct Rm, only set Carry but don’t change the
value of Rn and Rm. (Rn-Rm Î C?)
ANDR
Rn, Rm ﹔
D8
2
2
Rn logical AND Rm, set the solution to Rn.
(RnÍRn AND Rm)
MOVR
Rn, Rm ﹔
D9
2
2
Set the value of Rm to Rn. ( RnÍRm)
5. Sound & Melody Control
Instruction Format
LDSPADB Cn, Sn ﹔
LDSPADF
LDMYAD
PLAYSP
Cycle
Bytes
1n
2
4
Set the start address of Sound.
Cn, Sn ﹔
9n
2
4
Set the end address of Sound.
Mn ﹔
CF
2
4
Set the start address of Melody.
CE
2
3
Play Sound(PS4).
8E
1
2
Set Rn to Tempo value of Melody (PS5).
8F
1
2
Set Rn to the volume of output sound (PS6).
Cn, Data ﹔
TEMPO
GAIN
Code
Rn ﹔
Rn ﹔
Instruction Description
PS :
(1). Cn ﹕Code of Channel, n = 1A , 1B , 2A , 2B , 3A , 3B , 4A , 4B.
(2). Sn ﹕Code of Sound,sort by sequence,n = 0 ~ 9999.
(3). Mn ﹕Code of Melody Song, sort by sequence n = 0 ~ 9999.
(4). Data : Code of Sound Sample Rate, the value is during 0 ~ 31, reference B.Sound Processor to get
more description.
(5). Reference C. Melody Processor to get more description of Tempo Code.
(6). Volume is during 0 ~ 63,0 is mute,63 is MAX volume.
4
Ver1.1
API4000M
INTEGRATED
CIRCUITS INC.
SERIES
VOICE OTP MODULE
6. Input & Output Data
Instruction Format
INPUT PA, Rn ﹔
Code
Cycle
Bytes
Instruction Description
80
1
2
Set Data Port A to Rn.( Rn ÍPA)
INPUT
PB, Rn ﹔
81
1
2
Set Data Port B to Rn. ( Rn ÍPB)
INPUT
PC, Rn ﹔
82
1
2
Set Data Port C to Rn. ( Rn ÍPC)
OUT
PA, Rn ﹔
88
1
2
Set the value of Rn to Data Port A. (PAÍRn)
OUT
PB, Rn ﹔
89
1
2
Set the value of Rn to Data Port B. (PBÍRn)
OUT
PC, Rn ﹔
8A
1
2
Set the value of Rn to Data Port C. (PCÍRn)
OUT
PD, Rn ﹔
8B
1
2
Set the value of Rn to Data Port D. (PDÍRn)
OUT
PE, Rn ﹔
8C
1
2
Set the value of Rn to Data Port E. (PEÍRn)
PS :
(1). PA , PB , PC , PD , PE is Data Port A , B, C, D, E, Reference D. Data Port to get more description.
7. System Control
Instruction Format
CLINTR ﹔
Code
Cycle
Bytes
Instruction Description
C8
1
1
Clear Interrupt Signal
INTRE ﹔
C9
1
1
Make system can receive interrupt signal.
SHUTDN ﹔
CA
1
1
System shutdown.
PS : (1). Before executiving SHUTDN Instruction, be sure to executive INTRE Instruction first to assure system
can be restarted after shutdown.
B. Sound Processor
Sound Processor of API4000M use 4 bits ADPCM construction, it has 4 Sound Channel can play music
mixed by 4 different type sound.Sample Rate of Sound is during 4KHz ~ 32Khz, each Channel can has different
Sample Rate.Each Channel has 2 group Address Register for Sound Data, each group Address Register has a Start
Address Register and a End Address Register for Sound Data. Each Sound Channel can be Controlled by
Instruction PLAYSP, or Controlled by Melody Processor.Before Play Sound, Address of Sound Data must be set
first. The following is the description about setting with Channel, Address, and Sample Rate.
1. Channel :
Cn is the no. of Channel in Instruction LDSPADB, LDSPADF, and PLAYSP. Each Channel has A and B
2 group, A and B can’t play together. The folloeing is the Table.
Table B.1
Channel
CH1
CH2
CH3
CH4
Group
A
B
A
B
A
B
A
B
Cn
C1A
C1B
C2A
C2B
C3A
C3B
C4A
C4B
5
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
2. Address :
Sn is the no. of Sound in Instruction LDSPADB and LDSPADF, which is mean the Start Address and End
Address of Memory Sound Data. When Sound is Coding, compiler (API4000SE) will define Address of each
Sound, the Address can be used when program is compiling. If you want to set Address of Sound, just choice the
no. of Sound.
3. Sample Rate :
Data in Instruction PLAYSP is mean Code of Sample Rate, each code is equivalent a Sample Rate. There is
32 type Sample Rate during 4KHz to 32KHz, there is a C.2 Pitch Table in C.Melody Processor.
4. e.g.﹕
LDSPADB C1A , S9 ;
LDSPADF C1A , S9 ;
PLAYSP C1A , 19 ;
LDSPADB C2B , S21 ;
LDSPADF C2B , S21 ;
PLAYSP C2B , 19 ;
LDSPADB C3A , S123 ;
LDSPADF C3A , S123 ;
PLAYSP C3A , 0 ;
LDSPADB C4B , S888 ;
LDSPADF C4B , S888 ;
PLAYSP C4B , 0 ;
/* Set CH1A to Start Address of Sound9 */
/* Set CH1A to End Address of Sound9 */
/* Play Sound9 on CH1, Sample Rate is 16KHz */
/* Set CH2B to Start Address of Sound21 */
/* Set CH2B to End Address of Sound21 */
/* Play Sound21 on CH2,Sample Rate is 16KHz */
/* Set CH3A to Start Address of Sound123 */
/* Set CH3A to End Address of Sound123 */
/* Play Sound123 on CH3, Sample Rate is 4KHz */
/* Set CH4B to Start Address of Sound888 */
/* Set CH4B to End Address of Sound888 */
/* Play Sound888 on CH4, Sample Rate is 4KHz */
C. Melody Processor
Melody Processor inside API4000M use Wave Table construction to simulate the tone from musical
instrument, It can coinstantaneous play 4 Channel. Each Channel has 2 banks Wave Table, A group is reference
Address of treble tone, B group is reference Address of bass tone. treble tone range is during B3(71) ~ B4(83),
reference value is B3(71); bass tone range is during E1(40) ~ A#3(70), reference value is A#2(58). Each Melody
Note Data is in 2 byte form, 1st byte consists of 5bits Beat Data, 2bits Channel Data, and 1 bit Control Data, 2nd
byte consists of 5bits Pitch Data, 1 bit Bank Data, and 2bits Control Data. Melody Processor can processor 32 type
Beats, There is a Beat Table on Table C.1.
All processible Pitch range is during E1(40) ~ B4(83), total 36 type Note, Table C.2 is a list about Pitch Data,
Note, and Sample Rate. Tempo of Melody is set by Function TEMPO Rn, the value of Rn is from Code value of
Tempo, Table C.3 is about their reference.
Instruction LDMYAD Mn is used to set Start Address of Melody Data in Memory, Mn is the Code of Melody,
As Melody compiling, compiler(API4000ME) will define Data Address of each Melody, Data Address can be use
in coding. You can use Melody Code to set Address of Melody.
Melody’s playing is controlled by Instruction OUT PE, Rn, There is description about how to control in
D.Input & Output Data. Melody’s change instrument and end signal is defined in Melody Data, it will active 2
interrupt signal “Change Instrument” and “Song End”, if program detects such signal, it will do correspondent
action.
6
Ver1.1
API4000M
INTEGRATED
CIRCUITS INC.
SERIES
VOICE OTP MODULE
„ C.1 Beat Table :
NO.
Beats/sec
NO.
Beats/sec
NO.
Beats/sec
NO.
Beats/sec
0
1
2
3
4
5
6
7
1/16
2/16
3/16
4/16
5/16
6/16
7/16
8/16
8
9
10
11
12
13
14
15
9/16
10/16
11/16
12/16
13/16
14/16
15/16
16/16
16
17
18
19
20
21
22
23
18/16
20/16
22/16
24/16
26/16
28/16
30/16
32/16
24
25
26
27
28
29
30
31
36/16
40/16
44/16
48/16
52/16
56/16
60/16
64/16
„ C.2 Pitch Table :
Pitch Code
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PS :
Note
Bank B
—
E1
F1
F#1
G1
G#1
A1
A#1
B1
C2
C#2
D2
D#2
E2
F2
F#2
Fs (KHz)
Pitch Code
4.0
5.0
5.5
6.0
6.5
7.0
7.5
8.0
8.5
9.0
9.5
10.1
10.7
11.3
12.0
12.7
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Note
Bank B
G2
G#2
A2
A#2
B2
C3
C#3
D3
D#3
E3
F3
F#3
G3
G#3
A3
A#3
Bank A
—
—
—
B3
C4
C#4
D4
D#4
E4
F4
F#4
G4
G#4
A4
A#4
B4
Fs (KHz)
13.5
14.3
15.1
16.0
17.0
18.0
19.1
20.2
21.4
22.7
24.0
25.4
27. 0
28.6
30.3
32.0
(1). Pitch Code : 21 , Note number of C3 = 60.
(2). Bank A : treble tone; Bank B : bass tone.
(3). Fs : Sample Rate when Oscillator Frequency of API4000M is 2816KHz.
„ C.3 Tempo Table
Tempo
234
224
217
206
198
191
184
177
172
166
161
156
Code
234
233
232
231
230
229
228
227
226
225
224
223
Tempo
152
147
143
139
135
132
129
126
123
120
117
114
Code
222
221
220
219
218
217
216
215
214
213
212
211
Tempo
112
110
107
105
103
101
99
95
89
86
80
74
Code
210
209
208
207
206
205
204
202
198
196
192
186
Tempo
68
64
60
57
53
51
47
43
40
30
Code
180
176
170
166
158
154
146
136
126
86
PS : (1). The value of Tempo when Oscillator Frequency of API4000M is 2816KHz.
7
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
D. Input & Output Data
By the 2 Instruction INPUT and OUTPUT, Data can pass inside API4000M, or connect with outside. The
following is the description about each Data Port’s act.
1. Input Data Port
(1) PA ﹕Input Data Port A is a value consists of Input Pin PIO3 ~ PIO0 and PI3 ~ PI0, Following is their
correspondent.
PA
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
Input Pin
PIO3
PIO2
PIO1
PIO0
PI3
PI2
PI1
PI0
PS ﹕If PIO3 ~ PIO0 or PI2 ~ PI0 are set to Out Pin, bit7 ~ bit4 or bit2 ~ bit0 will be Unknown State.
(2) PB ﹕Input Data Port B can make Melody change Channel code of instrument and Instrument Code,
Each bit of PB has following act.
PB
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
Item
-
C1
C0
Inst4
Inst3
Inst2
Inst1
Inst0
PS﹕
(1). Inst4~Inst0 ﹕Code of Instrument, 0 ~ 31 total 32 type, set as Melody Compiling.
(2). C1,C0 ﹕Code of Channel﹔
C1=1,C0=1 is CH1 ﹔
C1=0,C0=0 is CH2 ﹔
C1=0,C0=1 is CH3 ﹔
C1=1,C0=0 is CH4 ﹔
(3) PC ﹕Input Data Port C is display End State of each channel, each pin of PC has following act.
PC
PS﹕
bit7
Bit6
bit5
bit4
bit3
bit2
bit1
bit0
Item
Sn4
Sn3
Sn2
Sn1
(1). Sn4 , Sn3 , Sn2 and Sn1 displayed Channel CH4 , CH3 , CH2 and CH1 if had happen Sound End,
state 1 means Soind End.
2. Output Data Port
(1) PA ﹕Output Data Port A consists of Output Pin PIO3 ~ PIO0 and PO3 ~ PO0, each bit of PA after
API4000M
power on, the initial state is 0, each pin of PA has following act.
PA
bit7
bit6
bit5
bit4
bit3
bit2
bit1
Output Pin
PIO3
PIO2
PIO1
PIO0
PO3
PO2
PO1
PS ﹕If PIO3 ~ PIO0 are set to Input Pin, bit7 ~ bit4 will not affect PIO3 ~ PIO0 of state.
8
bit0
PO0
Ver1.1
API4000M
INTEGRATED
CIRCUITS INC.
SERIES
VOICE OTP MODULE
(2) PB ﹕Output Data Port B consists of Output Pin PI2 ~ PI0, each pin of PB has following act.
PB
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
Output Pin
PI2
PI1
PI0
PS ﹕If PI2 ~ PI0 are set to Input Pin, bit2 ~ bit0 will not affect PI2 ~ PI0 of state.
(3) PC ﹕Output Data Port C can set Each Pin’s act of PIO3 ~ PIO0, Following is their correspondent.
bit7
bit6
bit5 bit4
0
0
Pull-low Input Pin, no input trigger.
0
0
Pull-low Input Pin, no input trigger.
0
1
Pull-low Input Pin, with input trigger.
0
1
Pull-low Input Pin, with input trigger.
1
0
Floating Input Pin, no input trigger.
1
0
Floating Input Pin, no input trigger.
1
1
Output Pin.
1
1
Output Pin.
Bit3
bit2
0
0
Pull-low Input Pin, no input trigger.
0
0
Pull-low Input Pin, no input trigger.
0
1
Pull-low Input Pin, with input trigger.
0
1
Pull-low Input Pin, with input trigger.
1
0
Floating Input Pin, no input trigger.
1
0
Floating Input Pin, no input trigger.
1
Output Pin.
PIO3
PIO2
bit1 bit0
PIO1
1
1
Output Pin.
1
PS ﹕Each bit of PC after API4000M power on, initial state is 0.
PIO0
(4) PD ﹕Output Data Port D can choice Data Bank, set Operate Voltage, set each pin of PO3 ~ PO0 and PI3 ~
PI0 function, following is their correspondent.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
bit7 not use, bit6 must set to 0.
bit5 = 0, Operate Voltage is 4.5V﹔bit5 =1, Operate Voltage is 3.0V.
bit4 = 0, disable PO3 ~ PO0 each Pin’s output﹔bit4 = 1, enable PO3 ~ PO0 each Pin’s output.
bit3 = 0, set PI2 ~ PI0 to Input Pin ﹔bit3 = 1, set PI2 ~ PI0 to Output Pin.
bit2 = 0 set PI3 to Pull-low Input Pin ﹔bit2 = 1 set PI3 to Floating Input Pin.
bit1 = 0 set PI2 ~ PI0 to Pull-low Pin ﹔bit1 = 1 set PI2 ~ PI0 to Floating Pin.
bit0 = 0 set Data Bank to group A of 16 registers ﹔bit0 = 1 set Data Bank to group B of 16 registers.
(h) Each bit of PD after API4000M power on, initial state is 0.
(5) PE ﹕Output Data Port E can set Sound and Melody’s operate mode, the following is description.
(a) bit7 must set 0.
(b) bit6 = 0, Sound Processor Off ﹔bit6 = 1, Sound Processor On.
(c) bit5 = 0, Melody Off ﹔bit5 = 1, Melody Start and On.
(d) bit4 = 0,no action ﹔bit4 = 1,Off Melody Channels.
(e) bit3 = 0, CH4 is Sound Mode ﹔bit3 = 1, CH4 is Melody Mode.
(f) bit2 = 0, CH3 is Sound Mode ﹔bit2 = 1, CH3 is Melody Mode.
(g) bit1 = 0, CH2 is Sound Mode ﹔bit1 = 1, CH2 is Melody Mode.
(h) bit0 = 0, CH1 is Sound Mode ﹔bit0 = 1, CH1 is Melody Mode.
(i) After API4000M shut down, Each bit of PE will reset to 0.
9
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
E. Memory Data Structure
Program Data, Melody Data, Sound Data of API4000M all input from outside, Each group Data are 8 bits,
Input from 8 Memory Data Input Port D7 ~ D0. API4000M can direct control 24bits Memory Address, output from
24 Memory Address Output Port A23 ~ A0. Data in Memory is in order of Program Data, Melody Data, Sound
Data. Program Data’s Start Address is 000000, Max. Address is 00FFFF, Program Data has max. 64K Bytes.
Melody Data’s Start Address is continue from Program Data’s End Address, Sound Data’s Start Address is
continue from Melody Data’s End Address, Highest Address is FFFFFF.
„
PROGRAM GUID
API4000M is controlled by Program to Play Sound or Play Melody, this chapter will descript how to write
a Program.
A. Initial State
After API4000M Power On, or wake up again after Shut Down, Program Data Address of API4000M is set
on Address 000000. You can use instruction OUTPC, OUTPD in the program’s first to set Pin act of PI3 ~ PI0,
PIO3 ~ PIO0, and PO3 ~ PO0. Every register in Data Bank after Power On has random initial value, but Shut
Down won’t change the value.
B. Play Sound
Before Playing Sound, Start Address and End Address of Sound Data which would be played must set on the
Channel want Play Sound. Use Instruction LDSPADB and LDSPADF set Address of Sound Data. Otherwise, the
Channel must be set to Sound Mode by Data Port PE, Sound Processor must be set on, and use Instruction CLINTR
to clear residual INTR3 interrupt signal . Then use Instruction PLAYSP to begin playing sound, use INTR3 to
detect interrupt signal, and use Instruction INPUT PC to detect the Sound had play over or not. The channel who
doesn’t play sound must be set to Melody Mode in Data Port PE, avoid mistake Sound End interrupt signal;
exercise Instruction CLINTR, or set Sound Processor to OFF, will clear interrupt signal INTR3.
C. Play Melody
Before Play Melody, except set Sound Data Address to decide instrument, Address of Melody Data also must
be set by Instruction LDMYAD, and set value of Melody Tempo, then use Instruction OUT PE set the channel
would play to Melody Mode, set Sound Processor ON, trigger to play Melody. When Melody playing, if the
interrupt signal INTR4(Change Instrument) be detected, use Instruction INPUT PB to decision which channel need
change instrument, reset trible/bass tone reference Sound Data Address of the channel directly. Melody play over
will send a interrupt signal INTR2(Song End), If you want pause or stop play Melody play, use Instruction
OUT PE to set Melody to OFF.
10
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
D. External Interface
PI3 ~ PI0 , PIO3 ~ PIO0 , and PO3 ~ PO0 is the link for API4000M connecting with outside, Instruction
INPUT PA, OUT PA, or OUT PB, can input or output Data. PI3 , or PI2 ~ PI0 that set to Input Pin, or PIO3 ~ PIO0
of Input Pin set with Trigger has any pin is High Level, there will send a interrupt signal INTR1(Key In), and Wake
Up API4000M in Shut Down. Before exercising Instruction SHUTDN, must exercise Instruction INTRE first, then
API4000M can Wake Up again.
E. Sample Program
MOVD R2 , 85 ;
OUT PC , R2 ;
MOVD R5 , 50 ;
GAIN R5 ;
LDSPADB C1A , S9 ;
LDSPADF C1A , S9 ;
MOVD R3 , 78 ;
OUT PE , R3 ;
CLINTR ;
PLAYSP C1A , 19 ;
/* R2 = 01010101 */
/* Set PIO3 ~ PIO0 to Trigger Input Pins */
/* R5 = 50 */
/* Set volume Level to 50 */
/* Set Start Address of Sound9 on CH1A */
/* Set End Address of Sound9 on CH1A */
/* R3 = 01001110 */
/* Set CH1 = Sound Mode, Sound Processor = ON */
/* Cleat interrupt signal INTR */
/* Sample Rate 16KHz , Play Sound9 on CH1 */
JUMP
JUMP
/* if Sound End go to P2 */
/* go to P1 */
P1:
INTR3 , P2 ;
ADDR , P1 ;
P2:
MOVD R3 , 15 ;
OUT PE , R3 ;
LDSPADB C1B , S11 ;
LDSPADF C1B, S11 ;
LDSPADB C1A , S12 ;
LDSPADF C1A , S12 ;
LDSPADB C2B , S11 ;
LDSPADF C2B , S11 ;
LDSPADB C2A , S12 ;
LDSPADF C2A , S12 ;
LDSPADB C3B , S13 ;
LDSPADF C3B , S13 ;
LDSPADB C3A , S14 ;
LDSPADF C3A , S14 ;
LDSPADB C4B , S15 ;
LDSPADF C4B , S15 ;
LDSPADB C4A , S16 ;
LDSPADF C4A , S16 ;
LDMYAD M0 ;
/* R3 = 00001111 */
/* Set CH1 = Melody Mode, Sound Processor = OFF */
/* Set Start Address of Sound11 on CH1B */
/* Set End Address of Sound11 on CH1B */
/* Set Start Address of Sound12 on CH1A */
/* Set End Address of Sound12 on CH1A */
/* Set Start Address of Sound11 on CH2B */
/* Set End Address of Sound11 on CH2B */
/* Set Start Address of Sound12 on CH2A */
/* Set End Address of Sound12 on CH2A */
/* Set Start Address of Sound13 on CH3B */
/* Set End Address of Sound13 on CH3B */
/* Set Start Address of Sound14 on CH3A */
/* Set End Address of Sound14 on CH3A */
/* Set Start Address of Sound15 on CH4B */
/* Set End Address of Sound15 on CH4B */
/* Set Start Address of Sound16 on CH4A */
/* Set End Address of Sound16 on CH4A */
/* Set Start Address of Melody Song 0 */
11
Ver1.1
INTEGRATED
CIRCUITS INC.
MOVD R7 , 204 ;
TEMPO R7 ;
MOVD R0 , 111 ;
OUT
PE , R0 ;
API4000M
SERIES
VOICE OTP MODULE
/* R7 = 204 */
/* Set Tempo = 99 */
/* R0 = 01101111 */
/* SetSound Processor = ON,Melody = ON,CH4 ~ CH1 to Melody Mode */
P5:
JUMP
JUMP
JUMP
JUMP
INTR1 , P40 ;
INTR2 , P30 ;
INTR4 , P20 ;
ADDR , P5 ;
/* if Key In go to P40 */
/* if Song End go to P30 */
/* if Change Instrument go to P20 */
/* go to P5 */
P20:
INPUT PB , R8 ;
CLINTR ;
ADDC R8 , 224 ;
JUMP CO0 , P22 ;
ADDC R8 , 192 ;
JUMP CO0 , P23 ;
ADDC R8 , 160 ;
JUMP CO0 , P24 ;
/* read data about changing instrument */
/* clear INTR4 */
/* if R8 < 32 */
/* if CH2 go to P22 */
/* if R8 < 64 */
/* if CH3 go to P23 */
/* if R8 < 96 */
/* if CH4 go to P24 */
P21:
LDSPADB C1B , S21 ;
/* Set Start Address of Sound21 on CH1B */
LDSPADF C1B , S21 ;
/* Set End Address of Sound21 on CH1B */
LDSPADB C1A , S22 ;
/* Set Start Address of Sound22 on CH1A */
LDSPADF C1A , S22 ;
/* Set End Address of Sound22 on CH1A */
JUMP ADDR , P5 ;
/* go to P5 */
P22:
LDSPADB C2B , S31 ;
/* Set Start Address of Sound31 on CH2B */
LDSPADF C2B , S31 ;
/* Set End Address of Sound31 on CH2B */
LDSPADB C2A , S32 ;
/* Set Start Address of Sound32 on CH2A */
LDSPADF C2A , S32 ;
/* Set End Address of Sound32 on CH2A */
JUMP ADDR , P5 ;
/* go to P5 */
P23:
LDSPADB C3B , S33 ;
/* Set Start Address of Sound33 on CH3B */
LDSPADF C3B , S33 ;
/* Set End Address of Sound33 on CH3B */
LDSPADB C3A , S34 ;
/* Set Start Address of Sound34 on CH3A */
LDSPADF C3A , S34 ;
/* Set End Address of Sound34 on CH3A */
JUMP ADDR , P5 ;
/* go to P5 */
P24:
LDSPADB C4B , S25 ;
/* Set Start Address of Sound25 on CH4B */
LDSPADF C4B , S25 ;
/* Set End Address of Sound25 on CH4B */
LDSPADB C4A , S26 ;
/* Set Start Address of Sound26 on CH4A */
LDSPADF C4A , S26 ;
/* Set End Address of Sound26 on CH4A */
JUMP ADDR , P5 ;
/* go to P5 */
12
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
P30:
MOVD R0 , 15 ;
OUT PE , R0 ;
CLINTR ;
JUMP ADDR , P50 ;
/* R0 = 00001111 */
/* Set Sound Processor = OFF, Melody = OFF */
/* clear INTR2 */
/* go to P50 */
INPUT PA , R12 ;
ADDC R12 , 254 ;
JUMP CO0 , P42 ;
/* read Input Port A data */
/* if R12 < 2 */
/* if PI0 = 1 go to P42 */
JUMP
JUMP
/* if Key In go to P41 */
/* go to P5 */
P40:
P41:
INTR1 , P41 ;
ADDR , P5 ;
P42:
JUMP INTR1 , P42 ;
MOVD R0 , 15 ;
OUT PE , R0 ;
/* if Key In go to P42 */
/* R0 = 00001111 */
/* Set Sound Processor = OFF, Melody = OFF */
INTRE ;
SHUTDN ;
END ;
/* enable INTR signal */
/* Shut Down API4000M */
/* End of Program , END must put in the end of program */
P50:
Pin-1
Pin-2
Pin-3
Pin-4
Pin-5
Pin-6
Pin-7
Pin-8
Pin-9
VCC-3V
PI2
PI0
PIO2
PIO0
PO2
PO0
SPK1
GND
Pin-10
Pin-11
Pin-12
Pin-13
Pin-14
Pin-15
Pin-16
Pin-17
Pin-8
VCC4V5
PI3
PI1
PIO3
PIO1
PO3
PO1
SPK2
GND
13
Ver1.1
INTEGRATED
CIRCUITS INC.
„
API4000M
SERIES
VOICE OTP MODULE
TYPICAL APPLICATION CIRCUIT
14
Ver1.1
INTEGRATED
CIRCUITS INC.
API4000M
SERIES
VOICE OTP MODULE
„ API4000 SSOP-56 PIN(300MIL) PACKAGE :
15
Ver1.1