data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
Go Back  Xtreme Visual Basic Talk > > > data recieved from mscomm different from hyperterminal


Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2011, 07:42 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default data recieved from mscomm different from hyperterminal


I have a problem receiving data in vB6 using de MSComm. First I used Hyperterminal and i got the data correctly but using vb6 i get it codified.
For example, instead of getting 49.15, I'm receiving de characters '9¬±5. For 17.25 I get ±·²5.
Is it a problem with the emulation type, something that hyperterminal does, and I need to configure in VB6? I also tried changing the data type of the variable where I'm saving the input but it doesn't work.
Any help will be very helpfull. Thanks
Reply With Quote
  #2  
Old 06-14-2011, 08:04 AM
DrPunk's Avatar
DrPunkdata recieved from mscomm different from hyperterminal DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

Weird characters through serial communications tend to mean that one of the comm's properties is not set correctly.

You should set the baud rate, data bits, parity, stop bits and handshaking of the comm port. Check that you're setting these up the same as they are set in hyperterminal.
__________________
There are no computers in heaven!
Reply With Quote
  #3  
Old 06-14-2011, 08:38 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

thanks, I already did that. the characters are not that weird, I mean that I always get the same symbol for number 4 and the same for number 7 and so on. That's why I guess it's an emulation problem. should I find a replacement for mscomm?
Reply With Quote
  #4  
Old 06-14-2011, 09:06 AM
DrPunk's Avatar
DrPunkdata recieved from mscomm different from hyperterminal DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

OK, so how are you reading the data from the port?
__________________
There are no computers in heaven!
Reply With Quote
  #5  
Old 06-14-2011, 09:09 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

Now I'm configuring the mscomm with the same parameters I did in hyperterminal and reading the data from the input buffer.
Reply With Quote
  #6  
Old 06-14-2011, 09:17 AM
DrPunk's Avatar
DrPunkdata recieved from mscomm different from hyperterminal DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

... and it's working? Not working?
__________________
There are no computers in heaven!
Reply With Quote
  #7  
Old 06-14-2011, 10:02 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

I'm getting data but not as I was expecting that's the purpose of my post.
Reply With Quote
  #8  
Old 06-14-2011, 10:57 AM
passel's Avatar
passeldata recieved from mscomm different from hyperterminal passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

I think DrPunk wanted to know how you were reading the input, i.e. reading into a byte array, or reading into a string. Could you post the piece of code that reads from the port and processes the data?
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #9  
Old 06-14-2011, 11:03 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

I'm saving it into an string, should it be byte array? Here's the code I'm using.

Private Sub Form_Load()
MSComm1.CommPort = 12
MSComm1.Settings = "9600,n,8,1"
MSComm1.Handshaking = 0
MSComm1.InputLen = 18
MSComm1.InBufferSize = 100
MSComm1.PortOpen = True
MSComm1.RThreshold = 1
MSComm1.SThreshold = 0
MSComm1.InputMode = comInputModeText
End Sub

Private Sub MSComm1_OnComm()
Dim inbuff As String
inbuff = MSComm1.Input
Text1.Text = Text1.Text + inbuff
End Sub
Reply With Quote
  #10  
Old 06-14-2011, 11:33 AM
passel's Avatar
passeldata recieved from mscomm different from hyperterminal passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

Since you can use hyperterminal, I don't know if you've installed the MSDN help that came with VB6, perhaps you can find the examples on-line, but in the directory in the default install,
C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98\Mscomm
is a project VBTERM.VBP.
If you have that available, or can find it online, you might see if it can read your input in the same manner as hyperterminal.

You shouldn't have to read into a byte array. Most of the cases where I've used the comm control, I was receiving structured data, not ASCII, so I used comInputModeBinary and read into a byte array.

I don't know if the InputLen = 18 is an issue. I usually leave it 0, so I read all characters in the receive buffer, rather than have MSComm1.Input return the characters from the receive buffer in blocks of some specific number.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #11  
Old 06-14-2011, 11:55 AM
Cerian Knight's Avatar
Cerian Knightdata recieved from mscomm different from hyperterminal Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,191
Default

As Passel does, I always concatenate to a Byte array and use comInputModeBinary so I can inspect the byte values directly. Then there is usually no problem figuring out what the source of the problem is. I also leave .InputLen at 0, as I do all parsing in code. Otherwise, grabbing any response mid-stream could offset all further data.
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
  #12  
Old 06-14-2011, 01:54 PM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

I will try usen byte arrays. I used inputlen 18 cause I don't need all the data recieved. What I most recieve should look like: P+ 39.45 P+ 40.5 P+ 41.2 etc.. it's the weight sent by a controller
Reply With Quote
  #13  
Old 06-15-2011, 08:54 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

I try using byte arrays. but doesn't work or I didn't make it work. It says expencting a matrix.
Where can I get MSDN. i dont have it on my installation cd.
Reply With Quote
  #14  
Old 06-16-2011, 08:29 AM
DrPunk's Avatar
DrPunkdata recieved from mscomm different from hyperterminal DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

MSDN for VB6 mscomm - http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx

I still maintain the settings are wrong somewhere. Infact you might just have to get rid of that InputLen and make it 0. Or you're reading it wrong somehow. Surely it's not a coincidence that...

1 = 110001 in binary.

The ± that you receive instead = 11110001 in binary.

Take off the first two bits are you'd have the 1 you're after.
__________________
There are no computers in heaven!
Reply With Quote
  #15  
Old 06-16-2011, 09:47 AM
Cerian Knight's Avatar
Cerian Knightdata recieved from mscomm different from hyperterminal Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,191
Post

Quote:
Originally Posted by paolpas View Post
I try using byte arrays. but doesn't work or I didn't make it work. It says expencting a matrix.
I use this (perhaps less well documented) method of implementing byte arrays:
Code:
Private Sub MSComm1_OnComm()
Dim BuffTemp() As Byte
Select Case MSComm1.CommEvent
  Case comEvReceive
    BuffTemp = MSComm1.Input
'rest of code here
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
  #16  
Old 06-16-2011, 09:50 AM
DrPunk's Avatar
DrPunkdata recieved from mscomm different from hyperterminal DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

Would it be possible for you to tell us what it is exactly that you're trying to communicate with?
__________________
There are no computers in heaven!
Reply With Quote
  #17  
Old 06-16-2011, 09:58 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

That's a great remark Dr Punk. Thank you very much.Now I will be able to convert my input taking off the MSB. Now the problem will be manipulating the data.. I hope not.
I'm communicating with an scale controller. this device uses rs422 to send the weight value to another controller of a packaging machine. WHat I'm doing is connecting to this scale controller only to read the data being sent and process it. It sends around 3 weights per second. So what I'll do is recognize the top weight (the scale full) and save that number.
I'll tell you how it goes.

I think I wont have to use byte arrrays Cerian Knight ..
Reply With Quote
  #18  
Old 06-16-2011, 10:01 AM
DrPunk's Avatar
DrPunkdata recieved from mscomm different from hyperterminal DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

I wasn't putting that out there as a fix (a fudge maybe being a better word), I was just trying to say that I believe the port settings are wrong somehow.

7 databits maybe.

Is there any online documentation for what you're talking to?
__________________
There are no computers in heaven!
Reply With Quote
  #19  
Old 06-16-2011, 10:06 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

Ok I get it.. but it could also work right? of course it will be great if it works only changing number of bits on settings. but if that's wrong why does it read correctly in hyperteminal which is also configured for 8 bits?
Reply With Quote
  #20  
Old 06-16-2011, 10:13 AM
paolpas paolpas is offline
Newcomer
 
Join Date: Jun 2011
Posts: 11
Default

the equipment I'm working with are buhler's soltronic control for bagging scales. I'm afraid they are a bit old so there is not online information anymore..
Reply With Quote
Reply

Tags
characters, emulation, hyperterminal, mscomm


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
 
data recieved from mscomm different from hyperterminal
data recieved from mscomm different from hyperterminal
 
-->