AT_Command学习

来源:互联网 发布:国内数据交易平台 编辑:程序博客网 时间:2024/05/18 01:01

AT Command

AT CommandHayes开发的一般用在手机设备上用来给一些modem来发送指令来实现特别的功能.

AT Command所有的指令都是以AT开头


使用方法

数据线连接上手机后,打开Windows附件里的的超级终端,选好通讯口,拨特率115200,流控制选无然后就可以使用AT指令了


有两种类型的AT Command:

1. Basic AT Commands

指令不是以+AT后面开头

For example, ATD, ATA, ATH( 都是跟电话有关的指令)

2. Extended AT Commands

a) Commands that starts with ‘+’, ‘$’, etc.

b) Example: AT+CMGS, AT+CMGR, AT+CGMM etc


带参数的AT Commands3种类型:

1. Read, 用来读取一个parameter的值

AT+<Command>?

例如:AT+CREG?

2. Write

AT+<Command>=<value>

例如:AT+W32K=1

3. Test

AT+<Command>=?(To determine the range of values supported)

Example:AT+CREG=?

返回值:+CREG: (0-2)(Response for the AT Command)


AT Command的返回值有3种类型:

o Terminal Responses(终端返回值)

o Final response of the command.(最终的结果)

o Indicates the success or failure of the command that is executed.(反映了是成功还是失败)

o Ex: OK, +CMS ERROR:<error_no>, +CME ERROR:<error_no>

o Unsolicited Responses(主动提供的返回值)

o Not related to the execution of any command.(跟我们输入的指令无关)

o Indicates occurrences of events like network registration, new SMS and incoming call.(反映了突然的事件,例如新的短消息新电话…)

o All AT commands end with a Terminal response. Unsolicited responses will be queued between command entry and associated terminal response

所有的AT Commands都必须以Terminal Responses结尾Unsolicited Responses跟Terminal Responses无关随着新的突然事件反映在终端上.

o Intermediate Responses(中间返回值)

o Indicates the progress of the execution of command.(反映了命令执行的过程)

o Ex: Reception of “>” prompt when AT+CMGS command is executed.


如果要查询AT Command, 可以查询相应的文档。

(我有放在我的下载资源列表里面, 可以下载的到。AT命令手册(中文).pdf)

下面列出来常用的AT Command

• AT – Ping the modem

• ATD – Dial a number, can be either data call or voice call

• AT+CMGS – Send a SMS

• AT+CMGR, AT+CMGL – Read stored SMS

• ATI – Read the  software revision used

• AT+CGMM – Current hardware version used

• ATE – Turn ON/OFF echo