[En-Nut-Discussion] adc.c in AVR

Ole Reinhardt ole.reinhardt at embedded-it.de
Tue Apr 15 15:25:59 CEST 2008


Hi Jakub,

> I didn't try ADC yet(next few days,but I don't need prescalar ;-) )
> I'am using Ethernut 1.I found something interesting in code by NutApi.
> In file arch/avr/dev/adc.c
> I think that in line 263 should be sbi not cbi.(for all cbi prescaler
> will be 1).
> In the end of message I print table from polish site AVR-GCC.
> Maybe I'm wrong, if that sorry.

According to the ATMega128 datasheet page 247:

Table 99. ADC Prescaler Selections
     ADPS2           ADPS1         ADPS0 Division Factor
        0               0            0          2
        0               0            1          2
        0               1            0          4
        0               1            1          8
        1               0            0          16
        1               0            1          32
        1               1            0          64
        1               1            1         128

So 0 / 0 / 0 is the same as 0 / 0 / 1. In both cases factor 2.

Perhaps it's an error in the datasheet? In fact it look a little bit
illogical, but according to the datasheet it's correct.

Regards,

Ole Reinhardt

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list