hab jetzt eigentlich nur noch ein problem & zwar wird der ausgang ab & zu selber gesetzt ohne das ne taste gedrückt wird bzw ein interrupt impuls auslöst?!
hat wer ne idee
aktuelle code, hab sogar ne doppelte abfrage drinnen aber komischer weise gehts noch immer nicht.
hilft da vielleicht der debounce befehl?
Code:
$regfile = "m8def.dat"
$baud = 9600
$crystal = 8000000
Set Pinb.2
Config Pinb.1 = Output
'LCD-Ausgabe
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
Config Lcd = 16 * 2
'' Interrupt Int0 config
Config Int0 = Falling
On Int0 Irq0
Enable Interrupts
Enable Int0
Dim Irq0 As Word
Do
Cls
Cursor Off
Lcd Irq0
Print
''abfrage ob taste gedrückt & Kontrolle ob irq0 noch nicht über 800
Abfrage:
If Pinb.2 = 0 Then
Waitms 250
If Pinb.2 = 0 Then
Gosub Rauf
Else
Gosub Halt
End If
End If
Waitms 100
If Irq0 > 6 Then
Gosub Halt
Irq0 = 0
Else
End If
Loop
'' bei Int0 wird irq0 um 1 erhöht
Irq0:
Incr Irq0
Return
'' wenn 800 impulse ereicht dann motor stopp
Halt:
Portb = &B00000000
Waitms 100
Return
'' wenn 800 interruptimpulse noch nicht erreicht sind motor läuft weiter
Rauf:
Portb = &B11111111
Return
Lesezeichen