mscomm - send/receive from serial port 
Author Message
 mscomm - send/receive from serial port

could someone give me a few simple pointers on the MSCOMM?

i will be using it to send and receive ascii string of 1 character in
length. Do i need to use handshakin, buffering, etc? I'm new to this

Basically, the comm sends a 1 char string to the port, then, it has to
wait to receive a different character back. Then another character
later, then one more. There are 4 phases, 1st I send a char, the last
3, I have to wait to receive diff chars from the port



Wed, 05 May 2004 03:49:39 GMT  
 mscomm - send/receive from serial port

Quote:

> could someone give me a few simple pointers on the MSCOMM?

> i will be using it to send and receive ascii string of 1 character in
> length. Do i need to use handshakin, buffering, etc? I'm new to this

> Basically, the comm sends a 1 char string to the port, then, it has to
> wait to receive a different character back. Then another character
> later, then one more. There are 4 phases, 1st I send a char, the last
> 3, I have to wait to receive diff chars from the port

Hi Mortar-

This is my standard serial port answer, so ignore what you already know:

--------------<BEGIN QUOTED SECTION>-----------------------------------

Under VB, the MSComm object handles the serial ports. If you are going
to use serial communications under VB,{*filter*} Grier's book is the next
step. Info at http://www.*-*-*.com/

You did not mention what version of VB you have, but if it is not a
"learning edition", you should have MSComm available to you. In VB, just
click the following menu items:
Tools-->Custom Controls-->Microsoft Comm Control

Then just drop an MSComm object on your form and start from there.

For samples, look for the VBTerm and Dialer projects in your
\SAMPLES\VBTERM folder on whatever drive you have installed VB.

Also visit Jan Axelson's site at http://www.*-*-*.com/ for info on all
things serial, parallel and USB.

For a quick look at MSComm visit this URL:
http://www.*-*-*.com/

But I would recommend the VB help on MSComm and *strongly* recommend
Grier's book. You'll be wise to have it on your desk until your project
is completed.

----------------<END QUOTED SECTION>---------------------------------

As to your specific questions: You may or may not need handshaking. This
depends on the hardware you are connected to. As to buffering, it
doesn't sound like you need much at all. TX and RX buffers could be
fairly small at low speeds, probably 16 - 64 characters. I would suggest
you try different combinations of the following for your output
statements:

MyString = "X" 'whatever character(s) you need to send

MSComm1.Output = MyString & VbCr  'Carriage Return only for some types
of hardware
         or
MSComm1.Output = MyString & VbCrLf ' Carriage Return and Line Feed for
modems and other DCE

Once you send your data, you have to wait for a response or until some
marker character is received.
Try using Hyperterminal and send a character or two and see what you get
back.

Good Luck,

Randy Barrow
--

==============================================
Please remove NOSPAM from address for replies
==============================================



Wed, 05 May 2004 13:17:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Send Voltage via MSCOMM Control and Serial Port

2. Receiving from serial port in qb4.5

3. Receiving ASCII Values Through Serial Port

4. Receiving binary data from a serial port

5. Serial port receive format?

6. Receive data thru the serial port.

7. MSComm: Closing the port after data received

8. View text received on serial port

9. Sendind and Receiving data from a serial port in Visual Basic

10. Can mscomm control send /receive extended ASCII?

11. MSComm Control: syncronization of sending and receiving

12. Using MSCOMM to send/receive data

 

 
Powered by phpBB® Forum Software