"AT" command help

Posted on 2006-11-29
Medium Priority
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.
Technology Partners: 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!


Expert Comment

ID: 18036120
These may be useful for you:
Great sample http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=51424&lngWId=1 (in VB)
AT command list: http://www.gotocm.com/PDF/JYSJATMLJS.pdf (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 1500 total points
ID: 18036146

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

621 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