?
Solved

Another Modem Question

Posted on 2001-07-21
11
Medium Priority
?
401 Views
Last Modified: 2008-03-17
I am trying to dial a long number with an older modem.  I tried to use the following but buffers are not cleared and the second section gets an OK right away.  How can I clear the modem buffers before the second section?

' a is first part of number string and b is second part  
 DialString = "ATDT" + a + ";" + vbCr
   MSComm1.CommPort = Val(CommPort)
   MSComm1.Settings = "9600,N,8,1"
   MSComm1.InputLen = 0
   MSComm1.PortOpen = True
   MSComm1.Output = DialString
   Do
      DoEvents
   FromModem = FromModem & MSComm1.Input
   List1.AddItem FromModem
   Loop Until InStr(FromModem, "OK" & vbCrLf)
   List1.AddItem "finished"
   MSComm1.Output = "ATH" + ";" + vbCr
   MSComm1.PortOpen = False
   dummy = DoEvents
'-------
   DialString = "ATDT" + b + ";" + vbCr
   MSComm1.CommPort = Val(CommPort)
   MSComm1.Settings = "9600,N,8,1"
   MSComm1.InputLen = 0
   MSComm1.PortOpen = True
   MSComm1.Output = DialString
   Do
      DoEvents
   FromModem = FromModem & MSComm1.Input
   List1.AddItem FromModem
   Loop Until InStr(FromModem, "OK" & vbCrLf)
   List1.AddItem "finished"
   MSComm1.Output = "ATH" + ";" + vbCr
   MSComm1.PortOpen = False
   dummy = DoEvents
0
Comment
Question by:Lee5
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 17

Expert Comment

by:inthedark
ID: 6305582
Where do you clear FromModem?  When you hit the seconds loop it should be empty else it will pick up what was in there from before.
0
 

Author Comment

by:Lee5
ID: 6305600
That is my question - How do I empty the modem??
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6305648
I agree with dark. Do you have a line such as:

FromModem = ""

between those two sections? If you don't, then it will still contain the "OK" from the first loop.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:KDivad
ID: 6305649
P.S. I doubt that you "empty the modem". Likely, when you read in the value, it's removed then.
0
 

Author Comment

by:Lee5
ID: 6305967
I put FromModem = "" 
between them but it does not clear the modem.  My list1 just keeps repeating the first number, so I know that the modem has not been cleared.

If I only use the first section, the modem dials fine.  I am trying to FIND OUT HOW TO CLEAR THE BUFFERS so I can dial the second part.  My phone is off the hook during the process so I won't lose the connection.
0
 
LVL 5

Accepted Solution

by:
KDivad earned 400 total points
ID: 6306208
The help file says this of the .Input method:

"Returns and removes characters from the receive buffer."

However, if the modem is likely to send back some codes that you simply want to ignore, you'll be interested in this:

"InBufferCount refers to the number of characters that have been received by the modem and are waiting in the receive buffer for you to take them out. You can clear the receive buffer by setting the InBufferCount property to 0."


Both entries are from the mscomm help file.
0
 

Author Comment

by:Lee5
ID: 6306264
I put
       MSComm1.InBufferCount = 0
      MSComm1.Input = 0
every place I could think of. - before closing comm1 in the first section and after opening comm1 in the second section.  The second loop still shows the number in the first loop.
I have read the help files and also have a Sams book on vb6 but can't find the specifics on clearing the buffers.
0
 
LVL 17

Expert Comment

by:inthedark
ID: 6306974
You need to search your hard drive for the sample application VBTERM.VBP.

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6858519
Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20154837.html




PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 

Author Comment

by:Lee5
ID: 6859014
Sorry for the delay - I never got an email on this one.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6859095
Thank you for responding.  Please click your Member Profile to ensure that all the information there for you is correct.

Moondancer - EE Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question