Library tutorials & articles

Com Ports - Technical Information

Handshaking

An integral part of managing the receive and transmit buffers is ensuring that the back-and-forth transmission of data is successful — that the speed at which the data is being received does not overflow the buffer limits, for example.

Handshaking refers to the internal communications protocol by which data is transferred from the hardware port to the receive buffer. When a character of data arrives at the serial port, the communications device has to move it into the receive buffer so that your program can read it. A handshaking protocol ensures that data is not lost due to a buffer overrun, where data arrives at the port too quickly for the communications device to move the data into the receive buffer.

You set the Handshaking property to specify the handshaking protocol to be used by your application. By default, this value is set to none (comNone). You can, however, specify one of the other following protocols:

Setting Value Description
comNone 0 No handshaking (Default).
comXOnXOff 1 XOn/XOff handshaking.
comRTS 2 RTS/CTS (Request To Send/Clear To Send) handshaking.
comRTSXOnXOff 3 Both Request To Send and XOn/XOff handshaking.


The protocol that you choose depends upon the device to which you’re connecting. Setting this value to comRTSXOnXOff supports both of the protocols.

In many cases, the communications protocol itself handles handshaking. Therefore, setting this property to something other than comNone may result in conflicts.

Note If you do set this value to either comRTS or comRTSXOnXOff, you need to set the RTSEnabled property to True. Otherwise, you will be able to connect and send, but not receive, data.

Comments

  1. 24 Aug 2004 at 13:53

    Hi U
    Can U  show me some page ,apllicate this code by VB . U can send my mail kychinh2002@yahoo.com
    thanks,i need it so much

  2. 24 Aug 2004 at 13:52

    Hi U
    Can U  show me some page ,apllicate this code by VB
    thanks,i need it so much

  3. 04 Aug 2004 at 04:40

    i am using mscomm with visual basic. i want to read/write data on serial port rs232. what code will i have to write and what properties i will have to change in mscomm. please help me as soon as possible.

  4. 03 Mar 2004 at 22:16
    However, i think you need to perfect it more on a particular section ....

    Do you know what command to issue so that when i call up the receiver's HP, i can get to know whether the receiver phone is ringing? and count the number of times the phone ring?? get i get those reponse? cause i am trying to do a miss call.
    In order to do that i need to know whether the phone rings .. if so i will let the phone ring for 3 times ... then hang up
    ..



    Another question is :

    comEvRing "6"
    Ring detected. Some UARTs (universal asynchronous receiver-transmitters) may not support this event.

    i understand that the above means that ring is detected. when the CommEvent is "6". However, what does it mean some UARTs may not support it ...

    Can any expert show me what that means? i dont seem to understand it.

    and my current modem is :
    3COM US ROBOTICS 56K FaxModem Model (455630-01)

    does my modem support that?
  5. 16 Dec 2003 at 22:45

    do your problem has solved?
    I meet the same problem now, visual basic text doesn't give any response to binary input.


    I really need your solution, if you already have it


    thanks

  6. 02 Sep 2003 at 13:23


    Modem CODES AT Attention Code. Must appear at start of all commands except A/ and +++.
    A Answer Command. Answer incoming call.
    A/ Repeat Last Command.
    Bn Bell Compatibility
    B,B0 Variable connection rate ITU-T (CCITT) Compatibility.
    B1 Variable connection rate Bell Compatibility.
    B2 Auto-mode V.22/Bell 212A protocols.
    B4 300 bps Bell 103 protocol.
    B5 1200 bps V.22/Bell 212A protocols.
    B6 2400 bps V.22/bis protocol.
    B7 4800 bps V.32 protocol.
    B8 9600 bps V.32 protocol.
    B9 14,400 bps V.32 bis protocol.
    Ds Dialing Command
    DP Dialing Command. Pulse Dialing.
    DR Dialing Command. Reverse.
    DS Dialing Command. Dial one of the srored numbers.
    DT Dialing Command. Tone Dialing.
    D@ Dialing Command. Wait for 5 seconds quiet.
    D, Dialing Command. Pause.
    D; Dialing Command. Resume command mode after dialing.
    D! Dialing Command. Hook Flash.
    E Echo Command
    E,E0 Echo Off.
    E1 Echo On.
    Hn Switch-Hook Control.
    H,H0 On Hook (hang up phone).
    H1 Off Hook (pick up phone).
    In Request Product Code and Checksum.
    I,I0 Return Product Code.
    I1 ROM checksum, product ID, ROM version number.
    I2 Compute ROM checksum.
    I3 Error Correctio Code.
    I4 Product ID, ROM version number, modem chip type, fax operatnig mode.
    Ln Speaker Volume
    L,L0,L1 Speaker Volume. Low Volume.
    L2 Speaker Volume. Medium Volume.
    L3 Speaker Volume. High Volume.
    Mn Monitor on/off
    M,M0 Speaker off.
    M1 Speaker on until online.
    M2 Speaker always on.
    M3 Speaker on until online and off while dialing.
    On Return to online mode.
    O,O0 Return to online mode.
    O1 Return to online mode and start retrain sequence.
    O2 Fall forward. Return to online mode.
    O3 Fall back. Return to online mode.
    P Pulse dialing.
    Qn Quiet Command
    Q,Q0 Display result codes.
    Q1 Don't display result codes.
    Q2 Display result codes when originating a call.
    Q3 Return numeric results 32 and 30 for CONNECT 9600 and CONNECT 4800.
    Q4 Return numeric results 12 and 11 for CONNECT 9600 and CONNECT 4800.
    Sr Direct Register Command
    Sn Select register n as default register.
    Sn? Read and display value in register n.
    Sn?^ Read and display value in register n in HEX.
    Sn=N Set register n to value N.
    Sn=N^ Set register n to value N in HEX
    Vn Verbal/Numeric Result Codes.
    U Update System password.
    V,V0 Numeric Result Codes.
    V1 Verbal Result Codes.
    Xn Enable Extended Result Code
    X,X0 No wait for dial tone. No busy. CONNECT 0-4 returned.
    X1 No wait for dial tone. No busy. CONNECT 0-5 and 9-20 returned.
    X2 Wait for dial tone. No busy. CONNECT 0-6 and 9-20 returned.
    X3 No wait for dial tone. Busy recognized. CONNECT 0-5,7 and 9-20 returned.
    X4 Wait for dial tone. Busy recognized. CONNECT 0-7 and 9-20 returned.
    Y Long Space Disconnect
    Z Reset Command
    &V Display al stored profiles.
    &Zn=s Store telephone number.
    +++ Escape Code. Switch from data mode to command mode.


    thanks to Oliver Lawrence lawrence@cdnet.cod.edu <lawrence@cdnet.cod.edu>

  7. 06 Aug 2003 at 21:55

    Good Day,


    I'm using VB6 MSComm with "2400,n,7,1" (settings) to dial up using ArtNet modem. I couldn't get any dial tone with the mentioned setting. However, when i change to "2400,n,8,1" it will be able to dial up ? When i use hyperterminal with "2400,n,7,1" to dial up, no problem at all. Any idea what's wrong ? Thanks in advance.

  8. 16 Jun 2003 at 22:06
    Hiii

    I really loved this article, nice one!

    Here is a complete list of all the AT commands I could get..

    -----------------------------------------------------------------------------------------------------------------------------------
    Table 1. Basic Data Modem AT Commands
    -----------------------------------------------------------------------------------------------------------------------------------

    A/    Repeat the last AT command string issued.
       An “AT” prefix is not used. Do not terminate this command
       with <ENTER>.

    A    Answer.
       Go off-hook and enter the answer mode. After 3 seconds the
       modem will initiate an answer tone.

    Bn    ITU-T or Bell® (Default=1)

       B0    Use ITU-T V.22 at 1200 bps, and ITU-T V.21at 300 bps
       B1    Use Bell® 212A at 1200 bps, Bell® 1035 at 300 bps.
       B2    Use ITU-T V.23 only. The originating modem transits at 75
           bps (and receives at 1200 bps); the answering modem receives
           at 75 bps (and transmits at 1200 bps)
       B3    Selects ITU-T V.23 only. The originating modem transmits at
           1200 bps (and receives at 75 bps); the answering modem
           receives at 1200 bps (and transmits at 75 bps)

    Cn    Carrier control option (Default=1)

       C0    Transmit carrier always off
       C1    Normal transit carrier


    D    Dial command


    En    Command Echo (Default=l)

       E0    Disables command echo from the modem.
       E1    Enables command echo from the modem.

    Fn    Online echo (Default=1)
       
       F0    Enables online echo
       F1    Disables online echo

    Hn    Hook Switch Control (Default=0)

       H0    Hangs up the telephone line
       H1    Picks up the telephone line

    In    Identification/checksum option (Default=0)
       I0    Reports product code
       I1    Reports modem chip firmware version
       I2    Verifies ROM checksum
       I3    Reports device set name
       I4    Reserved
       I5    Reserved for modem chip hardware configuration
       I6    Country code
       I7    Version of board manufacturer firmware
       I8    Features of modem firmware
       I10    Modem board configuration - bit set by board manufacturer
       I11    Modem board configuration - bits set by board manufacturer
       I14    SAFE device
       I20    Cirrus Logic silicon version
       I21    Cirrus Logic firmware version
       I22    Cirrus Logic manufacturer name
       I23    Cirrus Logic product model
       Ln    Speaker Volume control (Default=2)
       L0,1    Low volume.
       L2    Medium speaker volume
       L3    High speaker volume

    Mn    Speaker On/Off (Default=1)
       M0    Speaker off.
       M1    Speaker on until modem detects the carrier signal.
       M2    Speaker is always on when modem is off-hook.
       M3    Speaker off during dialing, on until modem carrier present

    Nn    Select data rate handshake (Default=1)
       N0    Handshake only at DTE-to-modem data rate
       N1    Begins handshake at DTE-to-modem data rate and falls to
           highest compatible rate

    On    Go Online (Default=0)
       O0    Returns modem to data mode
       O1    Retrains equalizer and then returns to data mode

    P    Pulse Dial

    Qn    Result Codes (Default = 0)
       Q0    Enables display of result codes
       Q1    Disables display of result codes

    Sn    Select an S-register
       Sn=x    Write to an S-Register
       Sn?    Read from an S-Register

    T    Tone Dial

    Vn    Result Codes Format (Default=1)
       V0    Enable short-form result codes. (Numeric)
       V1    Enable long-form result code. (Text or Verbose)

    Wn    Response code data rate (Default=0)
       W0    Reports DTE speed response codes
       W1    Reports DTE speed response codes
       W2    Reports DCE speed response codes
       W3    Reports DTE speed response codes and information on error
           correction and data compression

    Xn    Result Code type (Default=4)
       X0    Enables result codes 0-4; disables detection of busy and dial
           tone
       X1    Enables result codes 0-5, 10, and above; disables busy and dial
           tone detection
       X2    Enables result codes 0-6 and 10 and above; disables busy
           detection and enables dial tone detection
       X3    Enables result codes 0-5, 7, and 10 and above; enables busy
           detection and disables dial tone detection
       X4    Enables result codes 0-7 and 10 and above; enables busy and
           dial tone detection

    Yn    Long Space Disconnect (Default=0)
       Y0    Disable Long Space Disconnect
       Y1    Enable Long Space Disconnect

    Zn    Recall stored profile (Default=0)
       Z0    Resets modem and recalls user profile 0
       Z1    Resets modem and recalls user profile 1

    &Cn    DCD (data carrier detect) option (Default=1)
       &C0    Ignores remote modem status; DCD always on
       &C1    DCD set according to remote modem status

    &Dn    DTR Control, Data Terminal Ready (Default=2)
       &D0    In async mode, modem ignores DTR
       &D1    Modem switches to command mode when DTR switches on
       &D2    When DTR switches off, the modem goes on-hook and
           disables auto-answer mode; when DTR switches on, autoanswer
           is enabled
       &D3    Turning off DTR re-initializes the modem and resets values
           except UART registers

    &F    Load factory defaults

    &Gn    Guard tone option (1200 bps and 2400
  9. 25 Apr 2003 at 05:57
    I've used MSCOMM on Visual Basic to receive binary data from my own equipment (I've creative it).
    Even if I use Binarymode but my data was received is not format that my equipment was send. (My data can't converted by Cint() or Cbyte(), only Val() can converted it but result is zero).
    How I can receive binary data by MSCOMM?
  10. 19 Apr 2003 at 14:05

    http://www.angelfire.com/linux/jsanchez/NullmodemCables.htm


    SEND ME AN EMAIL FOR GIVE MORE BEST TECHNICAL HELP.


    GOOD DAY!!! AND HARE KRISHNA

  11. 19 Apr 2003 at 13:24

    you need know how make a null modem cable?

  12. 19 Mar 2003 at 10:15

    I want to communicate throught the com1 port using a Null modem cable. I need help in this regard.

  13. 24 Dec 2002 at 07:39

    i am using MSComm with Visual Basic . it does not read or write anything on the port. i dont have modem in my pc. i only want to read data from serail port rs232. i am using a time and attandance recorder which sends data on com1 and shows it on its software but when i read it with MSCOmm it shows nothing. Mscomm1.intBufferSize is o . please help me soon.

  14. 02 Jul 2002 at 06:37

    I want to design 2 programs Client /server which comunicate thru phone line, using MScomm Control.
    But i don't know how to make Mscomm waiting for a call like We do with Winsocket.
    could you kindly help me?

  15. 01 Jan 1999 at 00:00

    This thread is for discussions of Com Ports - Technical Information.

Leave a comment

Sign in or Join us (it's free).

MSDN Communities

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

Want to stay in touch with what's going on? Follow us on twitter!