'taktgeber02.bas $regfile = "2313DEF.DAT" 'AT2313 $crystal = 4000000 'Quarz: 8.0000 MHz Ddrb = &B00000000 'Pins PB0 - PB7 als Eingang konfigurieren Portb = &B11111111 'Pullups PD an Ddrd = &B01010000 'PD Eingang, PD6 und 4 Ausgang Portd = &B00101011 'Pullups PD an Config Timer1 = Timer , Prescale = 1 'Timer0-Takt= Quarz/1024 On Timer1 Ontimer1 Enable Timer1 Stop Timer1 On Int0 Starttaste 'Interrupt-Routine für Taste Config Int0 = Falling 'Interrupt 1 bei H/L-Flanke auslösen Enable Int0 On Int1 Stoptaste 'Interrupt-Routine für Taste Config Int1 = Falling 'Interrupt 1 bei H/L-Flanke auslösen Enable Int1 Enable Interrupts Dim Presetwert As Word Dim A As Byte Dim B As Bit Presetwert = 40000 B = 0 '======================================================================= '====================== Hauptschleife ================================== '====================================================================== Do A = Pinb Select Case A Case 251 : Presetwert = 25616 '25Hz Case 247 : Presetwert = 23950 '24Hz Case 239 : Presetwert = 10068 '18Hz Case 223 : Presetwert = 54440 '90Hz Case 191 : Presetwert = 56458 '110 Hz Case Else : Presetwert = 5600 '16 2/3 End Select If Pind.5 = 0 Then If Pind.2 = 1 Then Gosub Stoptaste End If Loop '================================================================= '================== Ende Hauptschleife ========================== '================================================================= Ontimer1: Timer1 = Presetwert Toggle B If B = 1 Then Toggle Portd.6 Return '================================================================= '================================================================= Starttaste: Portd.4 = 0 Start Timer1 Return '================================================================= '================================================================= Stoptaste: Stop Timer1 Portd.4 = 1 Portd.6 = 0 Return '================================================================= End