Operations; Sound Play Function - Epson Arm S1C31 Series Technical Manual

Cmos 32-bit single chip microcontroller
Table of Contents

Advertisement

22.4 Operations

22.4.1 Sound Play Function

Initialization
When using the Sound Play function, initialize the SDAC2 and HWP in this order as shown below.
Initializing SDAC2
1. If the SDAC2 output pins are configured for general-purpose ports, assign the SDAC2 output function
to the ports. (Refer to the "I/O Ports" chapter.)
To select two-pin output mode
- P5MODSEL register = (P5MODSEL register | 0x0003)
- P0MODSEL register = (P0MODSEL register & 0x0087)
To select four-pin output mode
- P0MODSEL register = (P0MODSEL register | 0x0078)
- P5MODSEL register = (P5MODSEL register & 0x00fc)
2. Configure the SDAC2 operating clock. (Refer to Section 21.3, "Clock Settings.")
- Set the SDAC2CLK.CLKSRC[1:0] bits to 0x02.
- Set the SDAC2CLK.CLKDIV[1:0] bits to 0x0.
- Set the SDAC2CLK.DBRUN bit to 1.
3. Set the SDAC2 control register.
- Set the SDAC2CTL.SDACEN bit.
- Set the SDAC2CTL.RESAMPRATE[10:0] bits to 0x400.
- Set the SDAC2CTL.RESAMPEN bit to 1.
- Set the SDAC2CTL.TONEON bit to 0.
4. Clear SDAC2 sound data registers.
- Set the SDAC2_0DAT.DAT[9:0] bits to 0x000.
- Set the SDAC2_1DAT.DAT[9:0] bits to 0x000.
5. Disable SDAC2 interrupts to occur.
- Set the SDAC2INTE register to 0x0000.
- Write 0x000f to the SDAC2INTF register.
6. Set the SDAC2 operating mode.
To use external audio amplifier
- Set the SDAC2MOD.PWMMODE[1:0] bits to 0x1.
To use external amplifier circuit composed of discrete parts
- Set the SDAC2MOD.PWMMODE[1:0] bits to 0x3.
Initializing HWP (Sound Play function)
7. Set the HWPCTL.HWPEN bit to 0.
8. Set the following HWP internal register bits (Sound Play function register bits):
- Set the FUNCTION.ID[7:0] bits to 0x01.
- INTMASK.TO_MUTE bit
- INTMASK.TO_PAUSE bit
- INTMASK.TO_PLAY bit
- INTMASK.TO_IDLE bit
- ROMADDR.ADDRESS[31:0] bits
- ROMSIZE.SIZE[31:0] bits
- KEYCODE.KEYCODE[31:0] bits
S1C31D41 TECHNICAL MANUAL
(Rev. 1.1)
22 HW Processor (HWP) and Sound Output (SDAC2)
Seiko Epson Corporation
(Clock source = OSC3)
(Clock division ratio = 1/1)
(Enable clock supply in DEBUG mode)
(Enable SDAC2)
(Initialize audio sampling frequency)
(Enable resampler)
(Disable square-wave tone generator)
(Clear Ch.0 sound data register)
(Clear Ch.1 sound data register)
(Disable interrupts)
(Clear interrupt flags)
(Normal mode)
(CPLM mode 2)
(Disable HWP)
(Select Sound Play function)
(Set mute interrupt mask)
(Set pause interrupt mask)
(Set playback start interrupt mask)
(Set idle state interrupt mask)
(Set sound ROM data start address)
(Set sound ROM data size)
(Set key code)
22-5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Arm s1c31d41

Table of Contents