das is erCode:Config Timer0 = Timer , Prescale = 256 'Konfiguriere Timer0 'beim Testboard Prescale=1024 On Timer0 Interr 'verzweige Bei Timer0 überlauf Abbruch2 Enable Interrupts Enable Timer0 Stop Timer0 A = 30 B = 1 Program: Cls Locate 1 , 1 Lcd "Reset" Waitms 200 Cls Do Loop Until Pina.0 = 0 Or Pina.2 = 0 If Pina.2 = 0 Then Goto Abbruch Waitms 30 Do Loop Until Pina.0 = 1 B = 1 Start Timer0 'anschalten Do Loop Until Pina.2 = 0 Or Pina.0 = 0 If Pina.0 = 0 Then Goto Abbruch Else Waitms 30 Do Loop Until Pina.2 = 1 Waitms 30 Do Loop Until Pina.2 = 0 Or Pina.0 = 0 If Pina.0 = 0 Then Goto Abbruch Else Waitms 30 Do Loop Until Pina.2 = 1 Waitms 30 Do Loop Until Pina.2 = 0 Or Pina.0 = 0 If Pina.2 = 0 Then Goto Abbruch Else Waitms 30 Do Loop Until Pina.0 = 1 Waitms 30 Do Loop Until Pina.2 = 0 Or Pina.0 = 0 If Pina.0 = 0 Then Goto Abbruch Else Waitms 30 Do Loop Until Pina.2 = 1 If B > 180 Then Goto Abbruch Else Waitms 30 End If A = 60 Portd.4 = 1 Portb.0 = 1 Waitms 800 Portd.4 = 0 Portb.0 = 0 A = 30 End If End If End If End If Goto Program Abbruch: Stop Timer0 B = 1 Portd.3 = 0 Locate 1 , 1 Lcd "Fehler:" Waitms 500 Locate 2 , 1 Lcd "Wartezeit" Wait A A = A + 30 If A >= 70 Then Cls Locate 1 , 1 Lcd "Code falsch" Portb.1 = 1 Stop Else Goto Program End If Interr: B = B + 1 Return End
Lesezeichen