Hab das jetzt mal mit der LED gemacht.
Und das Funktioniert auch, die Led geht an und nach 1sec wieder aus usw.Code:$regfile = "m128def.dat" $crystal = 4000000 'Ports konfigurieren Config Portd = Output 'Alle Port D Pins sind Ausgänge Config Portb = Input 'Alle Port B Pins sind Eingänge Ddra = 00000100 Config Spi = Hard , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 Spiinit 'Initialisierung der SPI-Schnittstelle Config Clock = Soft , Gosub = Sectic 'this is how simple it is 'assign the date to the reserved date$ 'The format is MM/DD/YY Date$ = "03.01.06" Time$ = "18:34:00" Timsk.toie0 = 0 Assr.as0 = 1 Tccr0 = &B00010101 Timsk.toie0 = 1 Enable Interrupts Waitms 1000 Do Loop Sectic: If Porta.2 = 0 Then Toggle Porta.2 Else Toggle Porta.2 End If Return End 'end program
Hab dann mal geprüft, ob das noch mit einem taster und Led an und aus
in der Schleife geht und das läuft.
Also das Funktioniert ja schon mal.Code:$regfile = "m128def.dat" $crystal = 4000000 Declare Sub Keypressed1 'Ports konfigurieren Config Portd = Output 'Alle Port D Pins sind Ausgänge Config Portb = Input 'Alle Port B Pins sind Eingänge Ddra = 00000111 Config Spi = Hard , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 Spiinit 'Initialisierung der SPI-Schnittstelle Config Clock = Soft , Gosub = Sectic 'this is how simple it is 'assign the date to the reserved date$ 'The format is MM/DD/YY Date$ = "03.01.06" Time$ = "18:34:00" Timsk.toie0 = 0 Assr.as0 = 1 Tccr0 = &B00010101 Timsk.toie0 = 1 Enable Interrupts Waitms 1000 Do Debounce Pina.1 , 0 , Keypressed1 , Sub 'Taster entprellen, reagiert wenn Taste losgelassen wird Loop Sectic: If Porta.2 = 0 Then Toggle Porta.2 Else Toggle Porta.2 End If Return Sub Keypressed1 If Porta.1 = 1 Then Toggle Porta.3 Else Toggle Porta.3 End If End Sub End 'end program







Zitieren

Lesezeichen