;---------------------------------------------- ; Analog-Digital-Umwandler ; ADC5 einlesen und an Port B ausgeben ;---------------------------------------------- .include "m8def.inc" .def temp = r16 .def temp1 = r22 .def temp2 = r23 .def temp3 = r24 .def lowByte = r17 .def highByte = r18 .def CHANNEL = R20 ldi temp, LOW(RAMEND) out SPL, temp ldi temp, HIGH(RAMEND) out SPH, temp ldi temp, 0xFF out DDRD, temp rcall lcd_init rcall lcd_clear ; ADC initialisieren ########################################### ; Bit 7 - externe Referenz ; Bit 6 - externe Referenz ; Bit 5 - left Adjust Result ; Bit 4 - ; Bit 3 - KANAL-Wahl ; Bit 2 - KANAL-Wahl ; Bit 1 - KANAL-Wahl ; Bit 0 - KANAL-Wahl ldi temp, 0b00000000 ;(ADC0...ADC5) out ADMUX, temp ; Kanal (AD0..AD5) einstellen ldi channel, 5 out ADMUX, channel ; ADC initialisieren mit "Free Run" und Vorteiler 128 ; Bit 7 -ADEN: ADC Enable ; Bit 6 -ADSC: ADC Start Conversion ; Bit 5 -ADFR: ADC Free Running Select ; Bit 4 -ADIF: ADC Interrzpt Flag ; Bit 3 -ADIE: ADC Interrupt Enable ; Bit 2 -ADPS2: Vorteiler ; Bit 1 -ADPS2: Vorteiler ; Bit 0 -ADPS2: Vorteiler ; Vorteiler von 3,5 ms bis 52 us einstellbar ldi temp, ((1<