
16 16-BIT AUDIO PWM TIMER (T16P)
16-6
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
Compare B buffer and B match counter
The compare B buffer (CMPB[15:0]/T16P_B register) is used to specify pulse periods. The buffer data is load-
ed to the compare B register and is compared with the counter value. The output signal level is inverted when
the counter reaches the compare data stored in the compare B register (B match). When a B match occurs the
counter is reset to 0x0 to start the next pulse period. This operation generates a pulse period according to the
compare B data specified.
When the counter reaches the compare B data, the B match interrupt flag (INTBF/T16P_INT register) is set to
1 and an interrupt occurs if B match interrupts are enabled.
The T16P controller includes the B match counter (BCNT[3:0]/T16P_CTL register) to set the sampling rate.
Set BCNT[3:0] to 0 to 15. When a B match occurs (BCNT[3:0] + 1) times, the compare A and B buffer data are
loaded into the compare A and B registers to start new sampling period.
The pulse period set by compare B data is as follows:
Output pulse period = (CMPB[15:0] + 1)
×
Count clock cycle
Sampling period
=
(CMPB[15:0] + 1)
×
Count clock cycle
×
(BCNT[3:0] + 1)
Volume Control
16.4.4
T16P includes a volume control function. To use this function, set VOLBPS/T16P_VOL_CTL to 0. The volume
control unit multiplies the PCM data stored in the compare A buffer by the specified volume level set using VOL-
SEL[6:0]/T16P_VOL_CTL register before loading to the compare A register. This makes it possible to adjust the
volume level to 1/64 through 127/64 as well as muting.
4.4.1 Volume Level Settings
Table 16.
VOLSEL[6:0]
Volume level
0x7f
×
127/64
0x7e
×
126/64
:
0x40
:
:
×
64/64
:
0x2
×
2/64
0x1
×
1/64
0x0
×
0 (mute)
(Default: 0x40)
When VOLBPS is set to 1 (default), the volume control unit is bypassed and compare A data is directly loaded
to the compare A register. When 8-bit PCM data is used, the volume control unit should be bypassed by setting
VOLBPS to 1.
4.4.2 Output Data with or without Volume Control
Table 16.
Input PCM data
Volume control circuit used
Volume control circuit bypassed
Signed 16-bit data: A
A
×
VOLSEL[6:0] + 0x8000
A + 0x8000
Unsigned 16-bit data: A
A
×
VOLSEL[6:0]
A
The volume controlled output data is limited to the range from 0x0 to 0xffff for both signed and unsigned PCM
data.
When signed 16-bit PCM data is input, the output data becomes 0x0 if the multiplication results are less than
-32768 or 0xffff if the multiplication results 32767.
When unsigned 16-bit PCM data is input, the output data becomes 0xffff if the multiplication results exceed
+65535.
Note: It is possible to alter the VOLSEL[6:0] values during playing sound, note, however, that set VOL-
SEL[6:0] before setting PRESET/T16P_CTL register if the first audio data must be output with
volume controlled.