Witam postanowilem sie troszke pobawic w bascomie51 ale zwykle pisze w asm i zatrzymałem sie na poważnym problemie niestety... jest sobie przerwanie
Przerwanie_t1: Load Timer1 , 65534 If Licznik_klaw = 12 Then
Licznik_klaw = 0 Stop Timer0 Disable Timer1 Enable Int0 Enable Int1 Set P3.2 Set P3.3 Else Incr Licznik_klaw End If Return
na słowie "Return" program stoi bardzo długo (sprawdzilem na symylatorze) pare tysiecy cykli maszynowych
moje pytanie co robie źle? bo czekanie w obsłudze przerwania pare tys cykli to jest niedopuszczalne i bezsensowne
oto cały program:
$crystal = 4194000 Set Tcon.0 Set Tcon.2 On Int0 Przerwanie_int0 On Int1 Przerwanie_int1 On Timer0 Przerwanie_t0 On Timer1 Przerwanie_t1 Config Timer0 = Timer , Gate = Internal , Mode = 1 Config Timer1 = Timer , Gate = Internal , Mode = 1 Dim A As Byte Dim Licznik_klaw As Byte Dim Licznik_podprogramu As Byte Declare Sub Demko0 Declare Sub Demko1 Declare Sub Demko2 Declare Sub Demko3 Declare Sub Demko4
Enable Int0 Enable Int1 Enable Interrupts
A = 255 P1 = 0 Licznik_podprogramu = 0 Licznik_klaw = 0 Do Select Case Licznik_podprogramu Case 0 : Call Demko0 Case 1 : Call Demko1 Case 2 : Call Demko2 Case 3 : Call Demko3 Case 4 : Call Demko4 End Select
Loop
Przerwanie_int0: Disable Int0 Load Timer1 , 65534 Start Timer1 Disable Int1
Enable Timer1
A = A - 20
Return
Przerwanie_t1: Load Timer1 , 65534 If Licznik_klaw = 12 Then
Licznik_klaw = 0 Stop Timer0 Disable Timer1 Enable Int0 Enable Int1 Set P3.2 Set P3.3 Else Incr Licznik_klaw End If Return
Przerwanie_int1: Disable Int1 Load Timer1 , 65534 Start Timer1
Disable Int0 Enable Timer1 Incr Licznik_podprogramu If Licznik_podprogramu = 5 Then Licznik_podprogramu = 0 End If
Return
Przerwanie_t0:
Return
Sub Demko0 anl p1,#00000001b Waitms A cpl p1.0 End Sub
Sub Demko1 anl p1,#00000010b Waitms A cpl p1.1 End Sub
Sub Demko2 anl p1,#00000100b Waitms A cpl p1.2 End Sub
Sub Demko3 anl p1,#00001000b Waitms A cpl p1.3 End Sub
Sub Demko4 anl p1,#00010000b Waitms A cpl p1.4 End Sub
End
Pozdrawiam AzaZeL