Solved

Serial Com

Posted on 2006-10-26
3
965 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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.

808 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