Any suggestions on using MSComm for serial communications?

I

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.
 
S

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.

Regards,

Steve
[email protected]
 
Go to Yahoo or "http://www.sympatico.com":http://www.sympatico.com and do a search by typing MSCOMM.

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

"http://www.yes-tele.com":http://www.yes-tele.com , has VB and Access code samples

"http://www.ontrak.net":http://www.ontrak.net , free Hyperterminal like emulator

"http://www.physics.brandeis.edu/phy32b_2002MSComm.doc":http://www.physics.brandeis.edu/phy32b_2002MSComm.doc , a very good WORD Document on MSComm

"http://vbrad.com/source/src_mscomm_tutorial.htm":http://vbrad.com/source/src_mscomm_tutorial.htm , info on control, troubleshooting guide & tutorial
on MSComm

plus many other links
 
Top