Panasonic MN101C77C Cell Phone User Manual


 
Chapter 15 A/D Converter
Operation
XV - 14
(1) Set the analog input pin that set in (2), to the
special function pin by the port A input mode
register (PAIMD). Also, set no pull-up/pull-
down resistance by the port A pull-up/pull-
down resistance control register (PAPLUD).
Set the analog I/O pin, set in (2), to input
mode by port A direction control register
(PADIR).
(2) Select the analog input pin from AN6-0 (PA6-
0) by the ANCHS2-0 flag of the A/D converter
control register 1 (ANCTR1).
(3) Select the A/D converter clock by the
ANCK1, ANCK0 flag of the A/D converter
control register 0 (ANCTR0).
(4) Set the sample hold time by the ANSH1,
ANSH0 flag of the A/D converter control
register 0 (ANCTR0).
(5) Specify the valid edge by the REDG3 flag of the
external interrupt 3 control register (IRQ3ICR),
the EDGSEL3 flag of the both edges interrupt
control register (EDGDT).
(6) Set the interrupt level by the ADLV1-0 flag of
the A/D conversion complete interrupt control
register (ADICR). If any interrupt request flag
is already set, clear them.
Setup Procedure
(1) Set the analog input pin.
PAIMD (x'3F3C')
bp0 : PAIMD0 = 1
PAPLUD (x'3F4A')
bp0 : PAPLUD0 = 0
PADIR (x'3F3A')
bp0 : PADIR0 = 0
(2) Select the analog input pin.
ANCTR1 (x'3FB1')
bp2-0 : ANCH2-0 = 000
(3) Select the A/D converter clock.
ANCTR0 (x'3FB0')
bp5-4 : ANCK1-0 = 01
(4) Set the sample hold time.
ANCTR0 (x'3FB0')
bp7-6 : ANSH1-0 = 01
(5) Specify the external interrupt 3 valid
edge.
IRQ3ICR (x'3FE5')
bp5 : REDG3 = 1
EDGDT (x'3F8F')
bp3 : EDGSEL3 = 0
(6) Set the interrupt level.
ADICR (x'3FFA')
bp7-6 : ADLV1-0 = 10
Description
A/D Conversion Setup Example by External Interrupt 3
The A/D conversion is started by the external interrupt 3. The analog input pin is set to AN0, the con-
verter clock is set to fs/4, and the sample hold time is set to TAD x 6. Then, the A/D conversion complete
interrupt is generated.
An example setup procedure, with a description of each step is shown below.
[ Chapter 3. 3-1-4 Interrupt Flag Setup ]