$regfile = "m88def.dat" $crystal = 22118400 '$baud = 19200 Config Lcdpin = Pin , Rs = Portb.0 , E = Portd.0 , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 Config Lcd = 16 * 2 Config Adc = Single , Prescaler = Auto , Reference = Avcc : Start Adc Config Portb.1 = Output , Portd.3 = Output , Portd.7 = Output 'b1=256/64 div., d7=pre+div power off Config Timer0 = Timer , Prescale = 1024 Config Timer1 = Counter , Edge = Rising 'Config Timer2 = Timer , Prescale = 1024 Set Portd.3 'power on Set Portd.4 'pullup taste Set Portb.1 'div 64 Config Int0 = Change : Enable Int0 : On Int0 Inte0: Enable Timer1 : On Timer1 Count1int: Enable Timer0 : On Timer0 Tim0ov: 'Enable Timer2 : On Timer2 Tim2: Enable Interrupts Dim C As Long , Ci As Long , Z As Long , A As Word , I As Integer , H As Long , T As Long Do Cls C = Counter1 Ci = Ci + C 'Ci = Ci / Z Lcd Ci H = H * 11 H = H / Z 'Lcd Z ; " " ; H Locate 2 , 1 A = Getadc(4) : I = -1 Do 'S-Wert berechnen A = A / 2 : I = I + 1 Loop Until A = 0 Lcd "S" ; I A = Getadc(5) ' U Batt. Locate 2 , 5 Lcd A ; "V" A = A / 100 Locate 2 , 4 Lcd A ; "," : Locate 2 , 9 H = 0 : Z = 0 : Ci = 0 : Counter1 = 0 'Tccr1b = 7 Enable Int0 Timer0 = 0 Do Loop Until H > 13400 And Timer0 > 140 Disable Int0 'Tccr1b = 0 Portd.3 = Pind.4 'power off Loop Inte0: Disable Int0 If Pind.2 = 1 Then Tccr1b = 7 Timer0 = 0 Z = Z + 1 Else Tccr1b = 0 T = Timer0 H = H + T End If Enable Int0 Return Count1int: Ci = Ci + 65536 'zählt die überläufe von counter1 Return Tim0ov: H = H + 256 Return End