Hallo,
mein programm benötigt einen timer, der eine variable hochzählt und beim überschreiten eine sprunganweisung machen soll. in dieser anweisung wird der timer derweil abgeschaltet mit disable timer0.
beim nächsten enable timer0 läuft dieser aber nicht mehr an.
woran kann das liegen?
gruß
holgerCode:$regfile = "m32def.dat" $crystal = 9000000 $baud = 9600 $hwstack = 64 $swstack = 64 $framesize = 64 Portd.5 = 1 Portb.0 = 0 Config Portb = Output Config Portd.2 = Output 'leds Config Portd.3 = Output Config Portd.4 = Output Config Portd.5 = Input 'taster Portd.5 = 1 Portd.6 = 1 Config Lcd = 16 * 2 Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.3 , Db6 = Portc.2 , Db7 = Portc.1 , E = Portc.5 , Rs = Portc.7 Config Lcdbus = 4 Config Lcdmode = Port Portc.6 = 0 'display rw bei Bascom immer 0 Config Portc = Output 'display Reset Portc.1 'write mode for display Initlcd Cursor Off Cls Dim A As Word Dim B As Word Config Timer0 = Timer , Prescale = 1024 'Konfiguriere Timer0 On Timer0 Interr 'verzweige Bei Timer0 überlauf Abbruch2 Enable Interrupts Wait 2 Locate 1 , 1 Lcd "Start" Wait 3 Cls A = 1 B = 1 Warten: If A > 1800 Then Do Portd.2 = 1 Wait 5 Loop Else Program: Cls Locate 1 , 1 Lcd "Programm" Wait 3 Cls Do Loop Until Pind.5 = 0 Enable Timer0 Portd.4 = 1 Wait 1 Portd.4 = 0 cls Locate 1 , 1 Lcd B Waitms 500 Cls Waitms 200 'anschalten Do Loop Until Pind.6 = 0 Or Pind.5 = 0 If Pind.5 = 0 Then Goto Abbruch Else Waitms 200 Do Loop Until Pind.6 = 0 Or Pind.5 = 0 If Pind.5 = 0 Then Goto Abbruch Else Waitms 200 Do Loop Until Pind.6 = 0 Or Pind.5 = 0 If Pind.6 = 0 Then Goto Abbruch Else Waitms 200 Do Loop Until Pind.6 = 0 Or Pind.5 = 0 If Pind.5 = 0 Then Goto Abbruch Else Waitms 200 Portd.3 = 1 Wait 1 Portd.3 = 0 End If End If End If End If End If Goto Program Abbruch: B = 1 Portd.3 = 0 Disable Timer0 Locate 1 , 1 Lcd "Fehler:" Waitms 500 Locate 2 , 1 Lcd "Wartezeit" Waitms 200 Wait A A = A + 1 Goto Warten Interr: B = B + 1 If B > 100 Then Goto Abbruch Else End If Return End







Zitieren

Lesezeichen