[En-Nut-Discussion] adc.c in AVR
jakub nowak
jdnowak at gmail.com
Tue Apr 15 14:37:44 CEST 2008
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.
u_char ADCSetPrescale ( u_char prescalar )
Definition at line 250 of file adc.c.
There is :
switch (prescalar) {
00260 case ADC_PRESCALE_DIV2:
00261 cbi(ADCSR, ADPS2);
00262 cbi(ADCSR, ADPS1);
00263 cbi(ADCSR, ADPS0);
00264 break;
00265 case ADC_PRESCALE_DIV4:
00266 cbi(ADCSR, ADPS2);
00267 sbi(ADCSR, ADPS1);
00268 cbi(ADCSR, ADPS0);
00269 break;
00270 case ADC_PRESCALE_DIV8:
00271 cbi(ADCSR, ADPS2);
00272 sbi(ADCSR, ADPS1);
00273 sbi(ADCSR, ADPS0);
00274 break;
>From AVR-GCC - polish(http://avr.elektroda.eu/?q=node/30):
ADPS2 ADPS1 ADPS0 prescalar
----------------------------
0 0 0 1
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
More information about the En-Nut-Discussion
mailing list