jerome57440
Messages postés40Date d'inscriptionlundi 3 mars 2008StatutMembreDernière intervention 8 juillet 2008
-
5 mars 2008 à 16:32
jerome57440
Messages postés40Date d'inscriptionlundi 3 mars 2008StatutMembreDernière intervention 8 juillet 2008
-
6 mars 2008 à 13:09
Bonjour,
j'ai fait une ptite application permettant de communiquer avec une carte par liaison rs232.
Le prog tourne bien j'arrive envoyer une trame a la carte mais le probleme est que je n'arrive pas a recevoir sa reponse.
Quelqu'un a til une solution pour palier a ce probleme.Je ne sais plus ou j'en suis.
Merci pour votre aide
voici le code:
Private Sub Form_Load()
MSComm1.CommPort = 1 'Definition des paramètres de configuration du port série
MSComm1.Settings = "9600,o,8,1"
MSComm1.InBufferCount = 0
MSComm1.SThreshold = 1
MSComm1.RThreshold = 1
MSComm1.InputLen = 0
Picture1.Visible = False
Picture2.Visible = False
Dim h As String
Dim recep As String
recep = ""
End Sub
Private Sub ouverture_Click() 'Ouverture du port COM1
MSComm1.PortOpen = True
If MSComm1.PortOpen = True Then
Picture1.Visible = True
Picture2.Visible = False
End If
End Sub
Private Sub fermeture_Click() 'Fermeture du port COM1
MSComm1.PortOpen = False
If MSComm1.PortOpen = False Then
Picture1.Visible = False
Picture2.Visible = True
End If
End Sub
Private Sub quitter_Click() 'Bouton quitter
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
Unload Me
Else
Unload Me
End If
End Sub
Private Sub requete_Click() 'Bouton envoi requeteIf Text4.Text "" Or Text5.Text "" Or Text6.Text = "" Then
MsgBox ("Veuillez remplir tous les champs avant le transfert!")
Else
a = CInt("&H" & Text1.Text)
b = CInt("&H" & Text2.Text)
c = CInt("&H" & Text3.Text)
d = CInt("&H" & Text4.Text)
e = CInt("&H" & Text5.Text)
f = CInt("&H" & Text6.Text)
g = CInt("&H" & Text7.Text)
h = a & b & c & d & e & f & g
Label2.Caption = h
MSComm1.Output = h
'For i = 1 To 10
'If InBufferCount <> 0 Then
recep = recep & MSComm1.Input
Text8.Text = recep
'Else
Sleep (1000)
'End If
'Next i
End If
End Sub
jerome57440
Messages postés40Date d'inscriptionlundi 3 mars 2008StatutMembreDernière intervention 8 juillet 2008 6 mars 2008 à 08:22
le inputmode =1 correspond au type de bonne lu par le buffer d'entrée. Dans ce cas ce sera du binaire si inputmode=1.
Pourquoi ne pouraait on pas mettre a 0 pour qu'il lise du texte
Merci d'avance