Solved

Serial Com

Posted on 2006-10-26
3
973 Views
Last Modified: 2012-08-13
Hi
I'm trying to establish GPRS connection in winxp via my phone used as modem on COM3.
I have used CreateFile, ReadFile, WriteFile for sending and receiving AT-commands and it seems to work as expected. However part of the response i get after sending a command is not returned before i send the next command.

Example:
Send1: ATZ\r
Receive1: ATZ\r
Send2: AT+CGATT=1\r
Receive2: \r\nOK\r\nAT+CGATT=1\r

The \r\nOK\r\n part i would like to be returned at the end of first reception, but not sure how to do this. I sniffed winxp dialup to see how it is done and it seems to use IOCTL_SERIAL_GET_COMMSTATUS: Retrieve COM status, in order to get last bytes. However I'm not sure how to do this in my program

Thanks in advance
0
Comment
Question by:connerdk
[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 16

Accepted Solution

by:
PaulCaswell earned 250 total points
ID: 17821737
Hi connerdk,

You need to give time for the OK to come through after Receive1:ATZ\r.

The ATZ is a command to the modem. The modem will echo every character you type/send. When it receives the \r it begins to execute the command. When you read what is in the comms buffer after you send the \r you are reading the characters it has already echoed. If you wait, perhaps up to about one second, checking for the 'OK' to come back it should arrive. You should do this for all commands you send.

Paul
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

Title # Comments Views Activity
memory leak detection 9 111
Problem in finding output of a program 11 116
C++ vs C compilers 13 169
Raspberry Pi 3 to send text message 9 240
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
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 for-loops in the C programming language.
Suggested Courses

738 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