Valamiért amíg nem történik egy megszakítás jól működik. Utána meg folyamatosan ismétli a megszakítást. Már átsakkoztam mindent de sehogy nem jó.
Kód: Egész kijelölése
$regfile = "m644Pdef.dat"
$crystal = 8000000
Config Lcd = 20 * 4
Config Lcdpin = Pin , Rs = Pina.5 , E = Pina.6 , Db4 = Pina.7 , Db5 = Pinc.1 , Db6 = Pinc.0 , Db7 = Pind.7
' KONSTANSOK
Const Debouncetime = 10
' VÁLTOZÓK
Dim Keycoderow As Byte
Dim Keycodecol As Byte
Dim Keycode As Byte
Dim Keychar As String * 1
' ALIASOK
Keyszakit Alias Pind.2
' PORT BEÁLLÍTÁSOK
Config Keyszakit = Input
Config Int0 = Falling
Enable Interrupts
On Int0 Button2
' KI/BE menet
Ddrb = &B00000111
'Config Pinb.0 = Output
'Config Pinb.1 = Output
'Config Pinb.2 = Output
' Fesz szint állítás
Portb = &B01111000
'Portb.0 = 0
'Portb.1 = 0
'Portb.2 = 0
'Portb.3 = 1
'Portb.4 = 1
'Portb.5 = 1
'Portb.6 = 1
Cls
Cursor Off
Locate 1 , 1
Lcd "Toxical Alarm System"
Enable Int0
Do
'Locate 3 , 1
'Lcd " "
'Locate 2 , 1
'Lcd " "
'Lcd Pinc.0
'Cls
'Porta.0 = 1
'Waitms 10
'Lcd "Riaszto"
'Porta.0 = 0
'Waitms 10
'Gosub Button
Loop
End
Button2:
Porta.0 = 1
Keycoderow = Pinb
Waitms Debouncetime
Ddrb = &B01111000
Portb = &B00000111
Waitms 1
Keycodecol = Pinb
Ddrb = &B00000111
Portb = &B01111000
Waitms Debouncetime
Porta.0 = 0
Locate 2 , 1
Lcd Keycoderow
Locate 3 , 1
Lcd Keycodecol
Return