MsComm Control for Using Xon/Xoff HandShaking 
Author Message
 MsComm Control for Using Xon/Xoff HandShaking

Hi ,

Now I have a problem in MsComm(VB6 SP3),
when Handshaking setting on Xon/Xoff,  example My Code
as below :

1). When Computer A send the Data Chr(17) to Computer B,
      In normally Computer B should get the Data Chr(17) by
      driving the EVEN comEvReceive( MSComm1.RThreshold = 1),
      but it do nothing,
2). In same condition, when Computer A Send the Data Chr(18) to Computer B,
     it can drive the EVEN  comEvReceive and Computer B can get
     the Data Chr(18).
3). I try again and again, If Computer A send a Data Chr(17) or Chr(19),then
     the Computer B will do nothing, even the MSComm1.InBufferCount=0,
     but if Computer A send any Data but Chr(17) or Chr(19), then Computer B
     will work normally as you want.

    I don't know why, but I really need to slove this probem.

    Appreciate to your help by return soon.

   Best Regards,
   Tom Liu

*** Computer A for Sending Data***************
Private Sub Form_Load()
        MSComm1.Settings = "9600,n,8,1"
        MSComm1.InputMode = comInputModeText
        MSComm1.PortOpen = True
End Sub

Private Sub Command1_Click()
MSComm1.Output = Chr(17)
End Sub
***************************

***** Computer B for Receiving Data***************
Private Sub Form_Load()
        MSComm1.Settings = "9600,n,8,1"
        MSComm1.InputMode = comInputModeText
        MSComm1.RThreshold = 1
        MSComm1.InputLen = 1
        MSComm1.PortOpen = True
End Sub

Private Sub MSComm1_OnComm()
Dim t, StrPos
Dim buf
Select Case MSComm1.CommEvent
        Case comEvDSR
        Case comEvRing
        Case comEvReceive   ' RThreshold # of Data
                  t = GetTickCount()
                 Do
                        DoEvents
                  Loop Until GetTickCount - t > 100
                 buf = MSComm1.Input
                 MsgBox buf
                 If buf = Chr(17) Then Text2.Text = "17"
                 If buf = Chr(19) Then Text2.Text = "19"
        Case comEvSend
    End Select
End Sub
**********************************



Fri, 20 Sep 2002 03:00:00 GMT  
 MsComm Control for Using Xon/Xoff HandShaking
Hi,

You do not NORMALLY attempt to process Xon/Xoff in your own code.  Rather,
you let MSComm handle it (the Windows communications API, in fact).
MSComm1.Handshaking = comXonXoff means that you cannot receive Xoff or
Xoff -- these characters are filtered out by the API.

If you intend to send and receive Xon/Xoff in your own code, you must set
MSComm.Handshaking = comNone.

For lots more information, you may be interested in my book.  See below.  I
go into these things in some detail, and include working code examples that
you may find to be helpful.

--
Richard Grier (Microsoft Developer MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com.



Fri, 20 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MsComm using Xon/Xoff probelm

2. MSComm VB4 - how can I change the XON/XOFF control chars to match DC1/DC4

3. Question on using Xon/Xoff flow control in VBDOS application

4. MSComm and Xon/Xoff

5. WIN95 + MSCOMM + Xon/Xoff

6. VB6 Comm XON/XOFF Handshake Not Working??

7. VB6 Comm XON/XOFF Handshake Not Working??

8. Does VB4 support xon/xoff?

9. help - how do I implement XonXoff Handshaking with MSComm

10. MSComm handshaking?

11. Handshaking and MSCOMM.VBX

12. MSComm handshaking trouble

 

 
Powered by phpBB® Forum Software