Answer to reset et mscomm

cs_akai Messages postés 2 Date d'inscription jeudi 2 janvier 2003 Statut Membre Dernière intervention 30 août 2003 - 25 août 2003 à 13:30
cs_akai Messages postés 2 Date d'inscription jeudi 2 janvier 2003 Statut Membre Dernière intervention 30 août 2003 - 30 août 2003 à 20:20
bonjour debutant en vb je but sur un probléme quant à la réception de l atr de divers carte a puce.
a chaque fois msComm1.InBufferCount me donne une valeur
supérieur à celle fourni aprés lecture des octets il en manque toujours deux.
ma base est un programme trouvé sur
http://petit.developpez.com/serie/cours_tcomport/serie_appl1.html

mon source:

Private Sub Command1_Click() 'ouverture du port
MSComm1.PortOpen = True
MSComm1.RTSEnable = True
SleepEx 100, 0
MSComm1.RTSEnable = False
SleepEx 400, 0
Command1.Visible = False
Command8.Visible = True
End Sub

Private Sub Command5_Click() 'ferme l'appli
End
End Sub

Private Sub Command6_Click() 'envoi d une commande
MSComm1.Handshaking = comXOnXoff

If Text2.Text = "" Then
MsgBox "entrez une commande"
Else
MSComm1.Output = Text2.Text
End If
End Sub

Private Sub Command7_Click()
On Error Resume Next
If MSComm1.OutBufferCount Then
SleepEx 150, 0

MSComm1.RTSEnable = True
MSComm1.RTSEnable = False
'rst = ""
Do
DoEvents
If (MSComm1.OutBufferCount) Then
rst = rst + AscB(MSComm1.Input)

End If
Loop While MSComm1.OutBufferCount

End If
Text3.Text = "OutBuffer : " & MSComm1.OutBufferCount & " | InputBuffer : " & MSComm1.InBufferCount
reponse.Text = rst
End Sub

Private Sub MSComm1_OnComm()
Text3.Text = "OutBuffer : " & MSComm1.OutBufferCount & " | InputBuffer : " & MSComm1.InBufferCount
End Sub

Private Sub reset_Click()
MSComm1.InBufferCount = 0
Dim rst As String
MSComm1.InputLen = 1
MSComm1.RTSEnable = True
SleepEx 100, 0
MSComm1.RTSEnable = False
SleepEx 400, 0
rst = ""
Do
DoEvents
While (MSComm1.InBufferCount)
rst = rst + Hex(AscB(MSComm1.Input))
Wend
Loop While MSComm1.InBufferCount
Text1.Text = " ATR:" & rst
End Sub
Private Sub Command8_Click()
MSComm1.PortOpen = False
Command1.Visible = True
Command8.Visible = False
Text3.Text = ""
Text1.Text = ""
MSComm1.InBufferCount = 0
End Sub

si quelqu un pouvait me venir en aide

merci

1 réponse

cs_akai Messages postés 2 Date d'inscription jeudi 2 janvier 2003 Statut Membre Dernière intervention 30 août 2003
30 août 2003 à 20:20
-------------------------------
Réponse au message :
-------------------------------

> bonjour debutant en vb je but sur un probléme quant à la réception de l atr de divers carte a puce.
> a chaque fois msComm1.InBufferCount me donne une valeur
> supérieur à celle fourni aprés lecture des octets il en manque toujours deux.
> ma base est un programme trouvé sur
> http://petit.developpez.com/serie/cours_tcomport/serie_appl1.html
>
> mon source:
>
> Private Sub Command1_Click() 'ouverture du port
> MSComm1.PortOpen = True
> MSComm1.RTSEnable = True
> SleepEx 100, 0
> MSComm1.RTSEnable = False
> SleepEx 400, 0
> Command1.Visible = False
> Command8.Visible = True
> End Sub
>
> Private Sub Command5_Click() 'ferme l'appli
> End
> End Sub
>
> Private Sub Command6_Click() 'envoi d une commande
> MSComm1.Handshaking = comXOnXoff
>
> If Text2.Text = "" Then
> MsgBox "entrez une commande"
> Else
> MSComm1.Output = Text2.Text
> End If
> End Sub
>
> Private Sub Command7_Click()
> On Error Resume Next
> If MSComm1.OutBufferCount Then
> SleepEx 150, 0
>
> MSComm1.RTSEnable = True
> MSComm1.RTSEnable = False
> 'rst = ""
> Do
> DoEvents
> If (MSComm1.OutBufferCount) Then
> rst = rst + AscB(MSComm1.Input)
>
> End If
> Loop While MSComm1.OutBufferCount
>
> End If
> Text3.Text = "OutBuffer : " & MSComm1.OutBufferCount & " | InputBuffer : " & MSComm1.InBufferCount
> reponse.Text = rst
> End Sub
>
>
>
> Private Sub MSComm1_OnComm()
> Text3.Text = "OutBuffer : " & MSComm1.OutBufferCount & " | InputBuffer : " & MSComm1.InBufferCount
> End Sub
>
> Private Sub reset_Click()
> MSComm1.InBufferCount = 0
> Dim rst As String
> MSComm1.InputLen = 1
> MSComm1.RTSEnable = True
> SleepEx 100, 0
> MSComm1.RTSEnable = False
> SleepEx 400, 0
> rst = ""
> Do
> DoEvents
> While (MSComm1.InBufferCount)
> rst = rst + Hex(AscB(MSComm1.Input))
> Wend
> Loop While MSComm1.InBufferCount
> Text1.Text = " ATR:" & rst
> End Sub
> Private Sub Command8_Click()
> MSComm1.PortOpen = False
> Command1.Visible = True
> Command8.Visible = False
> Text3.Text = ""
> Text1.Text = ""
> MSComm1.InBufferCount = 0
> End Sub
>
>
> si quelqu un pouvait me venir en aide
>
> merci
>
>

pas de reponse ??? est ce faisable
0
Rejoignez-nous