bonjour

voila je test une interface pour réceptionner des données venant d'un port série
en 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
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SerialPort1.Open()
        TextBox1.Text = SerialPort1.PortName & " Opened" & vbCrLf
    End Sub
 
    Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
        TextBox1.AppendText(SerialPort1.ReadExisting())
    End Sub
 
    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
 
    End Sub
 
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Select Case ComboBox1.Text
            Case "even"
                SerialPort1.Parity = 2
            Case "mark"
                SerialPort1.Parity = 3
            Case "none"
                SerialPort1.Parity = 0
            Case "odd"
                SerialPort1.Parity = 1
            Case "space"
                SerialPort1.Parity = 4
        End Select
    End Sub
 
    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        SerialPort1.PortName = ComboBox2.Text
    End Sub
 
    Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
        SerialPort1.BaudRate = ComboBox3.Text
    End Sub
 
    Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
        SerialPort1.DataBits = ComboBox4.Text
    End Sub
 
    Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox5.SelectedIndexChanged
        Select Case ComboBox5.Text
            Case "Xon / Xoff"
                SerialPort1.Handshake = 1
            Case "none"
                SerialPort1.Handshake = 0
        End Select
    End Sub
 
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SerialPort1.Close()
        TextBox1.Text = SerialPort1.PortName & " Closed" & vbCrLf
    End Sub
 
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            SerialPort1.DtrEnable = True
        End If
    End Sub
 
    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        If CheckBox2.Checked = True Then
            SerialPort1.RtsEnable = True
        End If
    End Sub
 
    Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
        If CheckBox3.Checked = True Then
            SerialPort1.NewLine = vbCrLf
        End If
    End Sub
   Private Sub TextBox2_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
        TextBox1.AppendText(TextBox2.Text)
    End Sub
End Class
donc la partie configuration des port et ouverture ca marche bien
j'ai repris les données de connexion utilisée habituellement a partir d'un hyper-terminal (baudrate, parity ...)

donc je réceptionne bien mes données mais je pense qu'il y a un pb d’interprétation des données car par exemple sous hyperterminal , je receptionne un comptage mémoire comme pour un PC et normalement le comptage doit se faire sur la meme ligne hors la chaque donné receptionné passe a la ligne

Code : Sélectionner tout - Visualiser dans une fenêtre à part
003A27128MB OK                                                                 003A27342MB OK                                                                 003A27556MB OK                                                                 003A27770MB OK                                                                 003A27984MB OK                                                                 003A28198MB OK                                                                 003A28413MB OK                                                                 003A28627MB OK                                                                 003A28841MB OK                                                                 003A29055MB OK                                                                 003A29269MB OK                                                                 003A29483MB OK                                                                 003A29697MB OK                                                                 003A29911MB OK                                                                 003AInitializing USB Controllers .. Done.                                           30268MB OK                                                                 003A30482MB OK                                                                 003A30696MB OK                                                                 003A30910MB OK                                                                 003A31124MB OK                                                                 003A31338MB OK                                                                 003A31552MB OK                                                                 003A31765MB OK
alors que devrait avoir une seul ligne du type

"31338MB OK" avec incrémentation de la valeur RAM testée

Donc voila mon pb , j'ai un pb d 'affichage des données

Merci de votre aide

a disposition si besoin de plus d'information
bonne journée

P.S je suis sous microsoft visual basic 2008 express