473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Help!- MSComm Control Madness

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

Oct 24 '05 #1
0 7582

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: stacy | last post by:
I used the wizard to upgrade an application from VB 6 to VB.net, the following warnings appear around the .Input method of the MSCOmm control 'UPGRADE_WARNING: Couldn't resolve default property of...
1
by: Peter Krikelis | last post by:
Hi, I am trying to develope a User Control Library that features MScomm control. I test my user control in a test application. When I run the application I receive the following: An...
1
by: jiatiejun | last post by:
I add the MSComm control in my C# program, but I can't get byte data, only to get string data; there are some problem when char >126 or <32 How to access NO ASCII char (for examples:...
1
by: pcserver | last post by:
How to add MSComm Control in #develop MSComm COM/OCX control.
8
by: Bob | last post by:
This is a bug that affects all controls, not just the ones that it's screwing up in my app. I really need a workaround. Anyone? Please? Before I regret letting my MSDN subscription run out and pay...
6
by: Barry Martin | last post by:
I am using an activex control mscomm to control a serial port in VB.NET. I place the control on the main form and set its port, baud rate, etc. properties. After creating a code module that needs...
1
by: Barry | last post by:
I am using the mscomm activex control in vb.net. I can add the control to the toolbar which will allow me to drop it onto a form. As long as I am in the code space for that form it works fine....
6
by: Tico Tech | last post by:
Hi: I have a question about the Microsoft Communications Control Version 6.0 from visual studio .net. I have this code: Dim Buffer As String Do Buffer = AxMSComm1.Input() //Error, it does...
4
by: ifitzgerald | last post by:
Hi, I am modifying a rather large and complex MFC application (written by someone else) written in Visual C++ 6.0 with service pack 6. I need to add serial communication functionality to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.