Solved

Another Modem Question

Posted on 2001-07-21
11
389 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now