beautypg.com

Api4000m, Integrated, Series – Rainbow Electronics API4000M User Manual

Page 10: Circuits inc. voice otp module, Program guid

background image

INTEGRATED

API4000M

SERIES

CIRCUITS INC. VOICE OTP MODULE

10


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.