"AT" command help

Posted on 2006-11-29
Last Modified: 2012-06-27
i have written a code on vc++ for connection of pc and mobile with function
openport()  : with createfile()
and functions for timeout settings
all functions r working properly

but how can i get a notification that a mobile is connected or not
and how can i use  AT command in my vc++ program.

Thanks in Advance
Question by:ddipro
  • 3
  • 3
  • 2
  • +1
LVL 16

Expert Comment

ID: 18035702
here is some descrition for ATc ommand
send the symbols in file and read symbols from file.

Author Comment

ID: 18035745
your answer does not match to my requirment.
please help in some relevent way so that i could be able to get it
LVL 16

Expert Comment

ID: 18036078
I think it is all what you need
>but how can i get a notification that a mobile is connected
Command Acknowledgment
The modem will acknowledge most commands almost immediately. As soon as you type in a command ending with the carriage return character your modem will respond with OK.
>and how can i use  AT command in my vc++ program
if you could write more code snipset then we wite you more concrete too.

Expert Comment

ID: 18036120
These may be useful for you:
Great sample (in VB)
AT command list: (note that they are not the same for each phone's kind)
According to GSM 07.07 and standard ATA commands the following is the case:

AT+CGMI:    Manufacture Identification
AT+CGMM:  Model Identification
AT+CGMR:   Software Revision Identification
AT+CGSN:    Serial Number Identification (IMEI)

To know when a mobile is connected or not to PC, you have to keep an eye on the port (pooling-port) with a loop sending AT commands and wait for device to answer by "OK", next step is to use AT command to know what kind it is and also wait for the reply.

Accepted Solution

taycuong76 earned 500 total points
ID: 18036146
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


Expert Comment

ID: 18036151

Expert Comment

ID: 18037298
Here's a few popular commands I use. Make sure you send a Carriage Return after each command. Also read the other information at the bottom of this post.

AT    (Initializes communication with the modem, not required to communicate with it though)
ATZ  (Sets the modem back to default settings)
ATI3  (Queries the modem for Manufacturer Information)
ATI4  (Also queries the modem for Manufacturer Information)
AT+GMM  (Queries modem for video capabilities)
AT+VCID=1  (Turns on CallerID functionality (with formatting), some modems)
AT#CID=1   (Turns on CallerID Functionality (with formatting), some other modems, (some modems respond to both))
AT#CID? or AT+VCID? (Queries the modem to check the current CallerID Setting)
ATS0=0  (Turns off the "auto-answer" feature)
ATS0=2  (Auto-Answers after 2 rings)
ATDT12125551212  (Dials a given phone number)
ATH  (Hangup command)

After sending the modem commands, it is necessary to give it a little bit of time to respond (also note that the modem will disregard or lose commands that are sent too quickly in succession). You should have an OnComm event that will catch modem responses.  This event needs to be allowed to run while and after you send commands to the modem. I use a Pause procedure to take care of this.  I also use Visual Basic so my examples here are VB.

Private Sub subPause(lngHowLong As Long)        
        Dim lngStart As Long
        lngStart = Timer  'Timer is the system timer that start counting after midnight
        Do While Timer < lngStart + lngHowLong
End Sub

So here's how I communicate with the modem in VB. This code doesn't do the "listening" for responses. That is happening in another procedure.

            comm1.Output = "ATI3" + vbCr
            subPause (1)
            comm1.Output = "ATI4" + vbCr
            subPause (1)

            comm1.Output = "AT+GMM" + vbCr
            subPause (1)

It is also necessary to know that for some features you will have to use TAPI instead of serial communications. Not all modems are TAPI compliant. And TAPI seems to be more intensive to learn to program (I've never learned it myself). If you want to send noises over the modem, such as text to speech, or Wav files, you will have to use TAPI.

Expert Comment

ID: 18037347
Sorry. My post applies only to a standard phone modem and doesn't really apply to the GSM part. I have never used a GSM modem. I'm a little late catching on.
LVL 16

Expert Comment

ID: 18037723

Author Comment

ID: 18051599
Ok thanks for ur cooperation
i have done this in my own way becaz ur most of the things was in VB.
i got some link from ur site that i will use for further improvement


Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now