Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Serial Com

Posted on 2006-10-26
3
Medium Priority
?
985 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 1000 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

Industry Leaders: 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

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…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops 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.

596 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