Information générale
Catégorie:
Codage, syntaxe et commandes
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement