Solved

Modem communication over serial port

Posted on 2006-10-26
3
783 Views
Last Modified: 2011-10-03
Hi Folks,

I'm trying to build a simple application that can dial a phone number of another modem (connected to a PC) or can recieve a call from another modem.

I've expiramented both ways using an instance of HyperTerminal on each PC and it works fine. One dials, the other answers and the connection is established.

I can't get this to happen when on one side I have my C application instead of HyperTerminal. I've used the same settings as with HyperTerminal so it's verified that I have the correct parameters.

The code I use basicaly initializes the port setting and then performs a "WriteFile" function call. After that I'm supposed to hear the modem dial (in case I'm the side that's dialing) but nothing happens.

The code I used is very similar to what's in: http://web6.codeproject.com/system/SerialPortComm.asp?df=100

The only difference is that before WriteFile I have:
strcpy(command, "ATZ\aATD45716\a"); // command for modem

where the number I dial is 45716.

I case I'm trying to pick up a call my command is:
strcpy(command, "ATZ\aATS0=1\a"); // command for modem

Any idea where the problem is and how I can get this to work?

Thanks in advance.
0
Comment
Question by:chayahd99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
daohailam earned 150 total points
ID: 17812922
IMO, it should be \r or \n or both \r\n instead of \a ?
0
 
LVL 22

Expert Comment

by:grg99
ID: 17813696
One big problem is the modem expects the "A" and the "T" to come in with a typing-like pause in between them, so the modem can figure out the baud rate, parity, and number of stop bits.

try writing the characters out ONE at a TIME, with say 1/4 second pause between them.  Might work better.

In general talking to a modem is very iffy-- the exact timing and responses are not all that well defined.

0
 

Author Comment

by:chayahd99
ID: 17897661
The \r did it. Wish I knew this earlier.
Thanks a lot.
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

Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

749 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