Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Modem communication over serial port

Posted on 2006-10-26
3
Medium Priority
?
786 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
3 Comments
 
LVL 5

Accepted Solution

by:
daohailam earned 600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

885 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