Solved

Another Modem Question

Posted on 2001-07-21
11
391 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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 100 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 37
MS SQL store procedure to calculate and return result 6 58
Help me. 3 56
Advice in Xamarin 21 80
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

803 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