Hi All,
I have 16 bytes 0x02, then "0F0270632E30" then <CR> then <LF> then 0x03
that are received by the serial port of my PCs.
The only variation is the string ASCII hex values
I know my serial port works on all machines as the data is correct in
Hyperterminal (9600, N, 8,1)
HELP
-----------
Using the PC with VB6 and Studio I can receive the data correctly OK
BUT.....
When I deploy the VB6 on to another PC the serial data received is in
correct.
Length of VarchrBuff on the deployed PC is 14 but should be 16?????
Both PCs run XP
Any help would be appreciated
MSComm1.InputLen = 0
MSComm1.InBufferSize = 1024
MSComm1.RThreshold = 12 ' Expect more than 12
MSComm1.InputMode = comInputModeBinary ' BINARY MODE
MSComm1.OutBufferSize = 1024
MSComm1.SThreshold = 0
'MSComm1.SThreshold = 512
'Handshaking options:
MSComm1.Handshaking = comNone
'Open the port.
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
End If
MSComm1.InBufferCount = 0
End Function
MSComm1_OnComm() in the receive code is as follows
Dim ComEventMessage As String
Dim StartPos, EndPos, i As Integer
Dim tagASCIIhex As String
Dim TagCRC As Byte
Dim VarchrBuff As Variant
Dim bytearray() As Byte
..
..
Case comEvReceive
ComEventMessage = "Receive buffer has RThreshold number of
characters."
If MSComm1.InBufferCount > 0 Then
VarchrBuff = MSComm1.Input: ' Get serial
data
MSComm1.InBufferCount = 0 ' Now we have data flush Rx buffer
StartPos = 0: EndPos = 0
bytearray() = VarchrBuff
For i = 0 To (LenB(VarchrBuff) - 1)
If bytearray(i) = 2 Then StartPos = 1: bytearray(i) = 32
If bytearray(i) = 3 Then EndPos = i: bytearray(i) = 32
Print "byte i = "; i; " byte = "; bytearray(i); " char ";
Chr(bytearray(i))
Next i
Print "LenB(VarchrBuff) = "; LenB(VarchrBuff)
End if