Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

MSComm help
I am trying to get data from a balance to my vb app using MSComm.  I know th
e
balance is transmitting because I can pick it up in hyperterminal.  I need t
o
get the value from the balance when the balance sends it so I believe I need
the OnComm method but I don't know how.

Any help greatly appreciated.

Thanks
Mike


Here is what I have:
Sub Form_Load()
Dim strBalanceOutput As String

MSComm1.CommPort = 2
' 9600 baud, Odd parity, 7 data, and 1 stop bit.
MSComm1.Settings = "9600,O,7,1"

'Open Com port
MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeText

Text1.Text = strBalanceOutput

End Sub

Report this thread to moderator Post Follow-up to this message
Old Post
Mike D
04-25-05 08:55 PM


Re: MSComm help
Check out this previous thread....
http://groups-beta.google.com/group...d39aeb36e359f27
Most likely the balance is transmitting Binary not Text data...
What kind of output are you seeing in Hyperterminal?


Report this thread to moderator Post Follow-up to this message
Old Post
btpanek09@yahoo.com
04-25-05 08:55 PM


Re: MSComm help
Hi,

I answered this question elsewhere.

You need to enable OnComm event handling (RThreshold = 1), and add code to
the MSComm OnComm subroutine to capture the data.  You also need the
manufacturer's information about the structure of the data to be captured.

Dick

--
Richard Grier  (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
www.mabry.com/vbpgser4 to order.



Report this thread to moderator Post Follow-up to this message
Old Post
Dick Grier
04-25-05 08:55 PM


Re: MSComm help
In hyperterminal I am seeing the numbers from the balance so in hypertermina
l
I see
N         +       72.14  g

So is the balance sending text or does hyperterminal convert?

Mike

"btpanek09@yahoo.com" wrote:

> Check out this previous thread....
> http://groups-beta.google.com/group...d39aeb36e359f27
> Most likely the balance is transmitting Binary not Text data...
> What kind of output are you seeing in Hyperterminal?
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Mike D
04-25-05 08:55 PM


Re: MSComm help
Thanks for the reply.  The balance docs say there is a 23-byte transmit
buffer and a 40-byte receive buffer.

Mike

"Dick Grier" wrote:

> Hi,
>
> I answered this question elsewhere.
>
> You need to enable OnComm event handling (RThreshold = 1), and add code to
> the MSComm OnComm subroutine to capture the data.  You also need the
> manufacturer's information about the structure of the data to be captured.
>
> Dick
>
> --
> Richard Grier  (Microsoft Visual Basic MVP)
>
> See www.hardandsoftware.net for contact information.
>
> Author of Visual Basic Programmer's Guide to Serial Communications, 4th
> Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
> www.mabry.com/vbpgser4 to order.
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Mike D
04-25-05 08:55 PM


Re: MSComm help
What you see s what youi're getting <g>
Normally (with due exceptions I imagine) scales send ASCII.

Saga

"Mike D" <MikeD@discussions.microsoft.com> wrote in message
news:4068EFAD-DE27-4790-AD4D-85686C32C6DC@microsoft.com...
> In hyperterminal I am seeing the numbers from the balance so in
> hyperterminal
> I see
> N         +       72.14  g
>
> So is the balance sending text or does hyperterminal convert?
>
> Mike
>
> "btpanek09@yahoo.com" wrote:
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Saga
04-26-05 01:55 AM


Re: MSComm help
OK.  But...

The details are critical.  The statement, "a 23-byte transmit
buffer and a 40-byte receive buffer,"  doesn't say anything about what the
data that are sent by the scale represent, nor the data format.

Dick

--
Richard Grier  (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
www.mabry.com/vbpgser4 to order.



Report this thread to moderator Post Follow-up to this message
Old Post
Dick Grier
04-26-05 01:55 AM


Re: MSComm help
Dick,

Thanks so much for your time.  I think I have found the details
Character Coding = 7-bit ASCII
Data output = 16 or 22 characters
Hardware handshake with 2 characters after CTS

I am stiil unable to get the ON_Comm to fire with this code

Sub Form_Load()
Dim strBalanceOutput As String

MSComm1.CommPort = 2
' 9600 baud, Odd parity, 7 data, and 1 stop bit.
MSComm1.Settings = "9600,O,7,1"

'Open Com port
MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeText

MSComm1.RThreshold = 1
MSComm1.SThreshold = 1


End Sub

Sub MSComm1_OnComm()
MsgBox ("Boo")

End Sub






"Dick Grier" wrote:

> OK.  But...
>
> The details are critical.  The statement, "a 23-byte transmit
> buffer and a 40-byte receive buffer,"  doesn't say anything about what the
> data that are sent by the scale represent, nor the data format.
>
> Dick
>
> --
> Richard Grier  (Microsoft Visual Basic MVP)
>
> See www.hardandsoftware.net for contact information.
>
> Author of Visual Basic Programmer's Guide to Serial Communications, 4th
> Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
> www.mabry.com/vbpgser4 to order.
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Mike D
04-26-05 01:55 AM


Re: MSComm help
Add RTSEnable = True

You don't need SThreshold (in fact, it never is needed).
--
Richard Grier  (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
www.mabry.com/vbpgser4 to order.



Report this thread to moderator Post Follow-up to this message
Old Post
Dick Grier
04-26-05 01:55 AM


Re: MSComm help
I can't get the OnComm event to fire.  My balance is sending data to
hyperterminal what am I missing?

Mike


Here is my code:
Dim MSComm1 As New MSComm

Sub Form_Load()
Dim strBalanceOutput As String

MSComm1.CommPort = 2

' 9600 baud, Odd parity, 7 data, and 1 stop bit.
MSComm1.Settings = "9600,O,7,1"

'Open Com port
MSComm1.PortOpen = True
MSComm1.RThreshold = 1
MSComm1.RTSEnable = True

MSComm1.InputMode = comInputModeText

End Sub

Sub MSComm1_OnComm()
MsgBox ("Boo")

End Sub




"Dick Grier" wrote:

> Add RTSEnable = True
>
> You don't need SThreshold (in fact, it never is needed).
> --
> Richard Grier  (Microsoft Visual Basic MVP)
>
> See www.hardandsoftware.net for contact information.
>
> Author of Visual Basic Programmer's Guide to Serial Communications, 4th
> Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
> www.mabry.com/vbpgser4 to order.
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Mike D
04-27-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:29 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.