Changeset 17627
- Timestamp:
- 03/18/14 16:19:43 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FSC/src/atmega_adc.c
r10910 r17627 5 5 { 6 6 //ADC einschalten 7 8 9 10 11 12 13 7 ADCSRA |= (1<<ADPS2) | (1<<ADPS1); // ADC_clk = 125kHz 8 ADCSRA &= ~(1<<ADPS0); 9 // normal conversion takes: 13 adc_clk cycles = 104us 10 // 1st conversion takes longer: 25 clk cycles = 200us 11 ADCSRA |= 1<<ADATE; // autotrigger enable 12 SFIOR &= ~(0xE0); //ADTS=000 --> free running mode 13 ADCSRA |= (1<<ADEN); // ADC aktivieren 14 14 15 16 17 18 19 20 15 ADMUX &= ~(1<<REFS0); 16 ADMUX &= ~(1<<REFS1); //REFS = 00 --> use external reference voltage. 17 //ADMUX |= 1<<ADLAR; //ADLAR =1 --> left adjust ac result in ADCH register --> 8bit resolution only. 18 ADMUX |= (0x1F & 0x06); //MUX = 0x06 --> Pin ADC6 = PA6 is used as ADC input pin. 19 20 ADCSRA |= (1<<ADSC); // start 1st conversion 21 21 22 22 }
Note:
See TracChangeset
for help on using the changeset viewer.