General discussion


To read from COM port

By MuthuVenkatsubramanian ·
I have a weighing m/c connected with COM port of my system .I want to read a set of data from it.I want to know wether it would be advisable to do in c++ or in VB?Can anybody guide me how to do the same.
Thank you!

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

To read from COM port

by johnfriz In reply to To read from COM port


Assuming that you have VB5 or 6, you should have access to the MSComm control. (if not you can download an Active X wrapper for it here: This page also hase a lot of good info on reading from/writing to COM ports)

Here is a simple example using the MSComm control

' Buffer to hold input string
Dim Instring As String

' Use COM1.
MSComm1.CommPort = 1

' Tell the control to read entire buffer when Input
' is used.
MSComm1.InputLen = 0

' Open the port.

MSComm1.PortOpen = True

' Wait for data to come to the port.
Loop Until MSComm1.InBufferCount >= 1

Read the info from the port
Instring = MSComm1.Input

' Close the serial port.MSComm1.PortOpen = False


Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums