witam
mam zrobioną obsługę wyświetlacza led na przerwaniach i problem z odbieraniem znaków przez uart mianowicie uart "gubi" znaki podczas odbioru, jeżeli wyłączę przerwania przerwania problem znika, niestety wyświetlacz muszę mieć zrobiony na przerwaniach i nie wiem jak mam się z tym problemem uporać. poniżej zamieszczam wybrane fragmenty kodu.
mam zrobioną obsługę wyświetlacza led na przerwaniach i problem z odbieraniem znaków przez uart mianowicie uart "gubi" znaki podczas odbioru, jeżeli wyłączę przerwania przerwania problem znika, niestety wyświetlacz muszę mieć zrobiony na przerwaniach i nie wiem jak mam się z tym problemem uporać. poniżej zamieszczam wybrane fragmenty kodu.
$regfile = "m32def.dat"
$crystal = 14745000
$baud = 19200
Config Serialin = Buffered , Size = 50
Config Serialout = Buffered , Size = 20
Config Timer0 = Timer , Prescale = 64
On Timer0 Wyswietlacz
Enable Timer0
Start Timer0
Enable Interrupts
Do
B_uart = Ischarwaiting()
If B_uart = 1 Then Gosub Odbierzuart
Loop
Wyswietlacz:
Stop Timer0
Godziny = _hour
Minuty = _min
Cyfra(1) = Godziny / 10
Cyfra(2) = Godziny Mod 10
Cyfra(3) = Minuty / 10
Cyfra(4) = Minuty Mod 10
If Cyfra(1) = 0 Then Cyfra(1) = 10
W1 = Lookup(cyfra(1) , Segmenty)
W2 = Lookup(cyfra(2) , Segmenty)
W3 = Lookup(cyfra(3) , Segmenty)
W4 = Lookup(cyfra(4) , Segmenty)
Reset D1disp1
Portb = W1
Waitms 3
Set D1disp1
Reset D1disp2
Portb = W2
Waitms 3
Set D1disp2
Reset D1disp3
Portb = W3
Waitms 3
Set D1disp3
Reset D1disp4
Portb = W4
Waitms 3
Set D1disp4
Start Timer0
Return
Odbierzuart:
Waitms 100
Dane_uart = ""
Do
A_uart = Inkey()
Dane_uart = Dane_uart + Chr(a_uart)
B_uart = Ischarwaiting()
Loop Until A_uart = Chr(13) Or B_uart = 0
Odebralem = 0
Odebralem = Instr(dane_uart , "MODAA")
If Odebralem > 0 Then
Godzina_uart = Mid(dane_uart , 6 , 2)
Minuta_uart = Mid(dane_uart , 8 , 2)
_hour = Val(godzina_uart)
_min = Val(minuta_uart)
End If
Return