The adc data register - adcl and adch, Scanning multiple channels, Adc noise canceling techniques – Rainbow Electronics ATmega163L User Manual

Page 97: Atmega163(l)

Advertising
background image

ATmega163(L)

97

The ADC Data Register - ADCL and ADCH

ADLAR = 0:

ADLAR = 1:

When an ADC conversion is complete, the result is found in these two registers.

When ADCL is read, the ADC Data Register is not updated until ADCH is read. Consequently, if the result is left adjusted
and no more than 8 bit precision is required, it is sufficient to read ADCH. Otherwise, ADCL must be read first, then ADCH.

The ADLAR bit in ADMUX affects the way the result is read from the registers. If ADLAR is set, the result is left adjusted. If
ADLAR is cleared (default), the result is right adjusted.

ADC9..0: ADC Conversion result

These bits represent the result from the conversion. $000 represents analog ground, and $3FF represents the selected ref-
erence voltage minus one LSB.

Scanning Multiple Channels

Since change of analog channel always is delayed until a conversion is finished, the Free Running Mode can be used to
scan multiple channels without interrupting the converter. Typically, the ADC Conversion Complete interrupt will be used to
perform the channel shift. However, the user should take the following fact into consideration:

The interrupt triggers once the result is ready to be read. In Free Running Mode, the next conversion will start immediately
when the interrupt triggers. If ADMUX is changed after the interrupt triggers, the next conversion has already started, and
the old setting is used.

ADC Noise Canceling Techniques

Digital circuitry inside and outside the ATmega163 generates EMI which might affect the accuracy of analog measure-
ments. If conversion accuracy is critical, the noise level can be reduced by applying the following techniques:

1.

The analog part of the ATmega163 and all analog components in the application should have a separate analog
ground plane on the PCB. This ground plane is connected to the digital ground plane via a single point on the PCB.

2.

Keep analog signal paths as short as possible. Make sure analog tracks run over the analog ground plane, and
keep them well away from high-speed switching digital tracks.

3.

The AV

CC

pin on the ATmega163 should be connected to the digital V

CC

supply voltage via an LC network as shown

in Figure 62.

4.

Use the ADC noise canceler function to reduce induced noise from the CPU.

5.

If some Port A pins are used as digital outputs, it is essential that these do not switch while a conversion is in
progress.

Bit

15

14

13

12

11

10

9

8

$05 ($25)

SIGN

-

-

-

-

-

ADC9

ADC8

ADCH

$04 ($24)

ADC7

ADC6

ADC5

ADC4

ADC3

ADC2

ADC1

ADC0

ADCL

7

6

5

4

3

2

1

0

Read/Write

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

Initial value

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Bit

15

14

13

12

11

10

9

8

$05 ($25)

ADC9

ADC8

ADC7

ADC6

ADC5

ADC4

ADC3

ADC2

ADCH

$04 ($24)

ADC1

ADC0

-

-

-

-

-

-

ADCL

7

6

5

4

3

2

1

0

Read/Write

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

Initial value

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Advertising