Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | /*############################################################################ |
2 | |||
3 | ############################################################################*/ |
||
4 | |||
5 | #include "main.h" |
||
6 | |||
7 | //############################################################################ |
||
8 | //Init ADC |
||
9 | void ADC_Init(void) |
||
10 | { |
||
11 | ADMUX = 0; |
||
12 | ADCSRA = 0x87; |
||
13 | ADMUX = 0; |
||
14 | ADCSRA |= 0x40; // Start Conversion |
||
15 | } |
||
16 | |||
17 | |||
18 | unsigned int MessAD(unsigned char channel) |
||
19 | { |
||
20 | unsigned int messwert = 0; |
||
21 | ADMUX = channel; |
||
22 | ADCSRA |= 0x10; // Clear Ready-Bit |
||
23 | ADCSRA |= 0x40; // Start Conversion |
||
24 | while (((ADCSRA & 0x10) == 0)); |
||
25 | messwert = ADCW; |
||
26 | return(messwert); |
||
27 | } |
||
28 | |||
29 | |||
30 |