Link to home
Start Free TrialLog in
Avatar of Lee5
Lee5

asked on

Another Modem Question

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
Avatar of inthedark
inthedark
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Lee5
Lee5

ASKER

That is my question - How do I empty the modem??
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.
P.S. I doubt that you "empty the modem". Likely, when you read in the value, it's removed then.
Avatar of Lee5

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of KDivad
KDivad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lee5

ASKER

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.
You need to search your hard drive for the sample application VBTERM.VBP.

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.
https://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.  https://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.
https://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 https://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.
Avatar of Lee5

ASKER

Sorry for the delay - I never got an email on this one.
Thank you for responding.  Please click your Member Profile to ensure that all the information there for you is correct.

Moondancer - EE Moderator