سلام
این کد رو برای نمایش دوتا فلش در تابلو نوشتم که با 4 تا کلید که یکیش به وقفه ها وصله کنترل میشه ولی وقتی کلید وقفه رو میزنم که عمل کنه یه بار شروع به عمل مبکنه و بدون توجه به کلیدهای دیگه کارشو تموم میکنه!
کد:
$regfile = "m16def.dat"
$crystal = 8000000
Config Portb = Output
Config Porta = Output
Dim Col As Byte
Dim Scan As Byte
Dim Refresh As Byte
Dim Index As Byte
Dim S As Byte
Dim R As Byte
Dim Mask As Byte
Dim A As Byte , X As Byte
Config Int0 = Rising
Enable Interrupts
enable int0
On Int0 Main
Do
Loop
End 'end program
Main:
Do
Debounce Pind.0 , 1 , Mehr
Debounce Pind.1 , 1 , Mehr1
Loop
Mehr:
Do
Debounce Pind.1 , 1 , Mehr2
Debounce Pind.3 , 1 , High1
Loop
Mehr1:
Do
Debounce Pind.0 , 1 , Mehr3
Debounce Pind.3 , 1 , Low1
Loop
Mehr2:
Do
Gosub High1
Gosub Low1
Loop
Mehr3:
Do
Gosub Low1
Gosub Hogh1
Loop
Low1:
For S = 0 To 8
A = 8 - S
Mask = &HFF
Shift Mask , Right , S
For Refresh = 1 To 10
Scan = &B00000001
For Col = 0 To 4
Portb = Lookup(col , Gelayof)
Shift Portb , Left , A
X = Portb Or Mask
Portb = Not X
Porta = Scan
Waitus 250
Rotate Scan , Left
Porta = &H00
Next Col
Next Refresh
Next S
For S = 0 To 8
A = 8 - S
Mask = &HFF
Shift Mask , Left , A
For Refresh = 1 To 10
Scan = &B00000001
For Col = 0 To 4
Portb = Lookup(col , Gelayof)
Shift Portb , Right , S
X = Portb Or Mask
Portb = Not X
Porta = Scan
Waitus 250
Rotate Scan , Left
Porta = &H00
Next Col
Next Refresh
Next S
Return
High1:
For S = 0 To 8
A = 8 - S
Mask = &HFF
Shift Mask , Left , S
For Refresh = 1 To 10
Scan = &B00000001
For Col = 0 To 4
Portb = Lookup(col , Gelayof1)
Shift Portb , Right , A
X = Portb Or Mask
Portb = Not X
Porta = Scan
Waitus 250
Rotate Scan , Left
Porta = &H00
Next Col
Next Refresh
Next S
For S = 0 To 8
A = 8 - S
Mask = &HFF
Shift Mask , Right , A
For Refresh = 1 To 10
Scan = &B00000001
For Col = 0 To 4
Portb = Lookup(col , Gelayof1)
Shift Portb , Left , S
X = Portb Or Mask
Portb = Not X
Porta = Scan
Waitus 250
Rotate Scan , Left
Porta = &H00
Next Col
Next Refresh
Next S
Return
Gelayof1:
Data &B11110111
Data &B11101111
Data &B11000000
Data &B11101111
Data &B11110111
Gelayof:
Data &B11110111
Data &B11111011
Data &B10000001
Data &B11111011
Data &B11110111
دستور return رو نمیخام مربوط به وقفه ها باشه بلکه برای gosub نوشتم
به نظرتون مشکل از این میتونه باشه؟