Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Serial Port
Message
De
13/07/2001 12:14:36
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Serial Port
Divers
Thread ID:
00530341
Message ID:
00530341
Vues:
48
I will be receiving data from one of the serial ports. The data will vary in length depending upon the device connected to the serial port(which rules out using Rthreshold). The only thing in the data that is common between the devices connected is the last character received, which will always be a Chr$(13). What I need is a routine that will buffer the data UNTIL the Chr$(13) is received. Once the Chr$(13) is received, the entire buffered data will be passed on to another routine for further processing, and the buffer will be ready for another string of data.

The incoming data will have a format such as:
111 22 11:11:11 22 22222222222 Chr(13)
or
2222 11 22 11:11:11 22222 222 111111111111111111111 1 11 Chr(13)

My current attempt is:

Private Sub MSComm1_OnComm()

If MSComm1.CommEvent = 2 Then

Do
DoEvents

Buffer$ = Buffer$ & MSComm1.Input
Loop Until InStr(Buffer$, Chr$(13))
Call HandleInput(Buffer$)
End If
End Sub
.
.
It appears the data is being received in 8 bit chunks and being passed on to "HandleInput", even though the Chr$(13) has not been received.

Thanks in advance. Any help would be appreciated.
Répondre
Fil
Voir

Click here to load this message in the networking platform