Any suggestions on using MSComm for serial communications?


Thread Starter

Irene Chavez

i need help in programming...i'm using visual basic 6 and am trying to use MSComm to communicate 2 PCs serially without using modem... i'm becoming confused. any suggestions on references, books, tutorials? i'm quite new to visual basic and would like to learn all i can about it. any help would be greatly appreciated.=)

One PC is supposed to be the main computer controlling the in flow of data from a remote computer in another location. the main computer contains the user interface wherein the operator can input data to change some measurement parameters like reference voltage or current... then, with the use of MSCOMM, transfer that operator action to the remote site. similarly, using MSCOMM, the remote computer can send data to the main computer and be able to log it using an appropriate program.
Hope you can help me.

Steve Crotty

I dont know if this will be that much help for ya, but when I used MSComm what I got stuck on was the OnComm event and how to work with a whole chunck of information.

The OnComm event is run every time the data in the serial port buffer reaches the RThreshold. If your information is going to be the same size every time, then just set your RThreshold to that size. Then whenever you have a whole packet you can process it in the OnComm event.

When I was playing with it, I was communicating using modbus, and with modbus the size of the packet (I guess that is what you would call it) being sent varies depending on what command your using. What I basically had to do was set RThreshold to 1, and continually add the information coming from OnComm to a variable. In ModBus the end of a packet is signaled by a vbCR vbLF. So when I received that I would process everything in the variable.

I hope tihs helps you some.


[email protected]
Go to Yahoo or "": and do a search by typing MSCOMM.

You will find some useful info on MSComm, some of them are:

"": , has VB and Access code samples

"": , free Hyperterminal like emulator

"": , a very good WORD Document on MSComm

"": , info on control, troubleshooting guide & tutorial
on MSComm

plus many other links