Bonjour.

Je continue mon application qui récupère et stocke dans un fichier csv des données GPS et des données récupérées par un combiné sepura(norme TETRA).
(cf http://www.developpez.net/forums/d77...nement-oncomm/

Mon nouveau problème vient du fait, dans un cas particulier, d'avoir plusieurs antennes qui émettent et il faut donc comparer les valeurs. Ce cas particulier m'oblige a devoir envoyer 2 commandes pour faire correctement le traitement,
en mode pas à pas le programme fonctionne mais en mode normal j'ai l'impression que le traitement se fait trop rapidement et donc ne se fait pas complètement, j'ai essayé de mettre une temporisation entre les différents envoies de commandes mais j'obtiens une erreur d'execution 8018: Opération reconnue uniquement lorsque le port est ouvert.

Voici le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Private Sub TraitementTETRA(TmpChaineTETRA, CommandeTETRA)
 
Dim Freq As String
Dim ChaineTETRA As String
Dim a As Integer
Dim nb_lignes As Integer
 
 
On Error Resume Next
Comm(2).InputLen = 0
TmpChaineTETRA = Comm(2).Input
Text2.Text = Text2.Text & TmpChaineTETRA
'Debug.Print TmpChaineTETRA
Label26.Caption = CommandeTETRA
 
If Option1 = True Then
 
    MNI = Split(TmpChaineTETRA, ",")(0)
    MNI = Right(MNI, 7)
    Freq = Replace(Split(TmpChaineTETRA, ",")(4), ".", ",")
    MCCH = (Freq - 400.0125) / 0.025
    LA = Split(TmpChaineTETRA, ",")(3)
    RSSI = Split(TmpChaineTETRA, ",")(1)
    C1 = Split(TmpChaineTETRA, ",")(5)
    NB = 0
    MAX_RSSI = RSSI
    Serveur = MCCH
    BNC_LA = Split(TmpChaineTETRA, ",")(6)
    BNC_RSSI = Left(Split(TmpChaineTETRA, ",")(8), 1)
    BNC_C2 = Split(TmpChaineTETRA, ",")(7)
 
 
    If TmpChaineTETRA <> vbCrLf & "OK" & vbCrLf Then
        If TmpChaineTETRA <> "" Then
            Label32 = MNI
            Label33 = MCCH
            Label34 = LA
            Label35 = RSSI
            Label36 = C1
            Label37 = NB
            Label30 = MAX_RSSI
            Label31 = Serveur
            Label39 = BNC_LA
            Label40 = BNC_RSSI
            Label41 = BNC_C2
        End If
    End If
 
ElseIf Option2 = True Then
    a = InStr(TmpChaineTETRA, "CCI")
    Debug.Print a
    Debug.Print TmpChaineTETRA
    If a <> 0 Then
            Debug.Print TmpChaineTETRA
        ReponseCCI() = Split(TmpChaineTETRA, vbCrLf)
        nb_lignes = UBound(ReponseCCI)
                MNI = ReponseCCI(1)
                MNI = Mid(MNI, a + 3, 7)
                Label32 = MNI
    End If
End If
 
End Sub
 
 
 
Private Sub Timer_Timer()
 
    If Option1 = True Then
        Comm(2).Output = CommandeTETRA
        CommandeTETRA = "at+cci?" & vbCr
        Call TraitementTETRA(TmpChaineTETRA, CommandeTETRA)
 
 
    ElseIf Option2 = True Then
        Comm(2).Output = CommandeTETRA
        CommandeTETRA = "at+cci?" & vbCr
        Call TraitementTETRA(TmpChaineTETRA, CommandeTETRA)
        tempo (0.5)
        Comm(2).Output = CommandeTETRA
        CommandeTETRA = "at+cnci?" & vbCr
        Call TraitementTETRA(TmpChaineTETRA, CommandeTETRA)
    End If
 
    If TmpChaineTETRA <> vbCrLf & "OK" & vbCrLf Then
        If TmpChaineTETRA <> "" Then
            Print #1, Heure & "; " & Longitude & "; " & Latitude & "; " & MAX_RSSI & "; " & Serveur & "; " & MNI & "; " & MCCH & "; " & LA & "; " & RSSI & "; " & C1 & "; " & NB & "; " & BNC_MCCH & "; " & BNC_LA & "; " & BNC_RSSI & "; " & BNC_C2
        End If
    End If
    TmpChaineTETRA = ""
    Comm(2).OutBufferCount = 0
    Comm(2).InBufferCount = 0
End Sub
 
Sub tempo(pause)
Dim Start As Integer
 
Start = Timer
Do While Timer < Start + pause
DoEvents
Loop
End Sub