Panasonic MN101C77C, F77G user manual Padir

Models: F77G MN101C77C

1 544
Download 544 pages 59.61 Kb
Page 488
Image 488

Chapter 15 A/D Converter

„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.

Setup Procedure

 

Description

 

 

(1) Set the analog input pin.

(1) Set the analog input pin that set in (2), to the

PAIMD(x'3F3C')

special function pin by the port A input mode

bp0 : PAIMD0 = 1

register (PAIMD). Also, set no pull-up/pull-

PAPLUD (x'3F4A')

down resistance by the port A pull-up/pull-

bp0 : PAPLUD0 = 0

down resistance control register (PAPLUD).

PADIR (x'3F3A')

Set the analog I/O pin, set in (2), to input

bp0 : PADIR0 = 0

mode by port A direction control register

 

(PADIR).

(2) Select the analog input pin.

(2) Select the analog input pin from AN6-0 (PA6-

ANCTR1(x'3FB1')

0) by the ANCHS2-0 flag of the A/D converter

bp2-0 : ANCH2-0 = 000

control register 1 (ANCTR1).

(3) Select the A/D converter clock.

(3) Select the A/D converter clock by the

ANCTR0 (x'3FB0')

ANCK1, ANCK0 flag of the A/D converter

bp5-4 : ANCK1-0 = 01

control register 0 (ANCTR0).

(4) Set the sample hold time.

(4) Set the sample hold time by the ANSH1,

ANCTR0 (x'3FB0')

ANSH0 flag of the A/D converter control

bp7-6 : ANSH1-0 = 01

register 0 (ANCTR0).

(5) Specify the external interrupt 3 valid

(5) Specify the valid edge by the REDG3 flag of the

edge.

external interrupt 3 control register (IRQ3ICR),

IRQ3ICR (x'3FE5')

the EDGSEL3 flag of the both edges interrupt

bp5 : REDG3 = 1

control register (EDGDT).

EDGDT (x'3F8F')

[

Chapter 3. 3-1-4 Interrupt Flag Setup ]

bp3 : EDGSEL3 = 0

 

 

(6) Set the interrupt level.

(6) Set the interrupt level by the ADLV1-0 flag of

ADICR (x'3FFA')

the A/D conversion complete interrupt control

bp7-6 : ADLV1-0 = 10

register (ADICR). If any interrupt request flag

 

is already set, clear them.

 

 

 

XV - 14 Operation

Page 488
Image 488
Panasonic MN101C77C, F77G user manual Padir