• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Dial up and communicate with a machine use COM Port

The hardware is:
    1. PC connect to Modem using COM1, modem connect to
telephone line.
    2. The other side is a Machine (control by AT89c2051 microCPU) connect to modem using COM Port, the modem connect to telephone line.

I want to do this:
      The PC dial up to the Machine, and then communicate with
the machine using COM port.
      The PC and Machine only use three  signal lines (TX, RX,GND) to communicate with the modem.

I can communicate with the machine throght COM by RS-232
Direct connect line.

MY PC (WIN98,VB6, using MSCOMM control)

Can anybody tell me how to communicate with the machine
through modem?

  • 4
  • 3
1 Solution
All you should have to to is send:

MSComm1.Output = "AT 555-1212" + VbCrLf

Where 555-1212 is the number you are dialing...

On the other side you have to send the following string to the modem:

ATS0= <number of rings to answer on>

For example, ATS0=3 will pick up the phone on the 3rd ring...

hxbAuthor Commented:
Thank for your help.

Please give me more detail suggestion.

The PC and the Machine communication in Binary mode.
As long as you set you communication line up for the right speed, parity, and stop bits, this is not going to be a problem...

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

hxbAuthor Commented:
       I tried, but there are l some problems.
 1.  When I send ATS0=3 , sometimes the modem not
     "OK", I have to try again,  How can I know if the mode is

 2.  The modem will send me some message trough
     Com1, such "CONNECT 9600"  "RING", If I receive data
    from the COM1, I will recieve these message.
    How can I set the modem to do not send these message,
    and let me only receive the data that sent by remote
Answer for #1:

Send "ATZ"+VbCrLf to modem before sending "ATS0=3"+VbCrLf

This will "reset" the modem before setting switch 0 to 3.

Answer for #2:

Your coded really needs to handle connect and ring messages, however, you can send:

"ATV0"+CbCrLf to the modem to turn verbose messages off.  Hayes message numbers will come back instead of connect and ring messages.

hxbAuthor Commented:
     Thank for your help, I try my best, but there are a lot
of problem.
     Can you give me a code like :
           1. Dial the Phone number
           2. Display dialing status like  
                 "NO DIALTONE", "BUSY", "NO ANSWER" "CONNECT"
           3. Let the user know that dial is OK
           4. When communicating, if the line is hangup or disconnect, Let the user know.

Can you help me?
I will increase the points if you can help me!


There is a complete sample project on how to use the MSComm Control on your visual basic CD.


It's a basic terminal package.

Hope this helps.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now