Pozbierałem różne fragmenty z forum i zlepiłem coś takiego
Nie robi tego co powinno czyli set porta.0 kiedy tel dzwoni.
Komunikuje się z telefonem poprawnie - sprawdzalem, wiec blad w programie.
Co mam nie tak?
Dodano po 24 [minuty]:
dla potomności: Naprawiłem...
Nie robi tego co powinno czyli set porta.0 kiedy tel dzwoni.
Komunikuje się z telefonem poprawnie - sprawdzalem, wiec blad w programie.
Co mam nie tak?
$regfile = "m32def.dat"
$crystal = 16000000
$baud = 19200
Config Serialin = Buffered , Size = 100
Config Porta.0 = Output
Enable Interrupts
Declare Sub Oproznij_bufor
Declare Sub Odczytaj_uart
Declare Sub Odczytaj_sprzetowy_uart
Dim Ringtxt As Byte
Dim Bufor As Byte
Dim Ring As Byte
Dim Kod As String * 100
Dim Dane As String * 200
Dim Stan As Bit
Ringtxt = "RING"
Stan = 0
Waitms 100
Print "ATX0" ; Chr(13) 'Odpowiadaj
Waitms 100
Print "ATZ" ; Chr(13) 'Ustaw domyślnie
Waitms 100
Print "ATE0" ; Chr(13) 'WYLACZ ECHO
Waitms 100
Print "AT+CLIP=1" ; Chr(13) 'Wlaczanie prezentacji numeru
Waitms 100
Set Porta.0
Waitms 100
Reset Porta.0
Waitms 100
Gosub Oproznij_bufor
Do
Call Odczytaj_uart
If Stan = 1 Then Set Porta.0
If Stan = 0 Then Reset Porta.0
Loop
Odczytaj_uart:
Do
Kod = Inkey()
Dane = Dane + Chr(kod)
Bufor = Ischarwaiting()
Ring = Instr(dane , Ringtxt)
If Ring > 0 Then
Stan = 1
Wait 1
Print "ATH" ; Chr(13)
Waitms 100
Ring = 0
End If
Gosub Oproznij_bufor
Loop Until Bufor = 0 Or Kod = "13"
Oproznij_bufor:
Do
Kod = Inkey() 'Czyści bufor
Bufor = Ischarwaiting()
Dane = "0"
Loop Until Bufor = 0
Return
Dodano po 24 [minuty]:
dla potomności: Naprawiłem...
$regfile = "m32def.dat"
$crystal = 16000000
$baud = 19200
Config Serialin = Buffered , Size = 100
Config Porta.0 = Output
Enable Interrupts
Declare Sub Oproznij_bufor
Declare Sub Odczytaj_uart
Declare Sub Odczytaj_sprzetowy_uart
Dim Ringtxt As Byte
Dim Bufor As Byte
Dim Ring As Byte
Dim Kod As String * 100
Dim Dane As String * 200
Dim Stan As Bit
Ringtxt = "RING"
Stan = 0
Waitms 100
Print "ATX0" ; Chr(13) 'Odpowiadaj
Waitms 100
Print "ATZ" ; Chr(13) 'Ustaw domyślnie
Waitms 100
Print "ATE0" ; Chr(13) 'WYLACZ ECHO
Waitms 100
Print "AT+CLIP=1" ; Chr(13) 'Wlaczanie prezentacji numeru
Waitms 100
Set Porta.0
Waitms 100
Reset Porta.0
Waitms 100
Gosub Oproznij_bufor
Do
Call Odczytaj_uart
If Stan = 1 Then Set Porta.0
If Stan = 0 Then Reset Porta.0
Loop
Odczytaj_uart:
Kod = Inkey()
Dane = Dane + Chr(kod)
Bufor = Ischarwaiting()
Ring = Instr(dane , Ringtxt)
If Ring > 0 And Stan = 0 Then
Stan = 1
Wait 1
Print "ATH" ; Chr(13)
Waitms 100
Ring = 0
End If
If Ring > 0 And Stan = 1 Then
Stan = 0
Wait 1
Print "ATH" ; Chr(13)
Waitms 100
Ring = 0
End If
Gosub Oproznij_bufor
Return
Oproznij_bufor:
Do
Kod = Inkey() 'Czyści bufor
Bufor = Ischarwaiting()
Dane = "0"
Loop Until Bufor = 0
Return