Chinaunix首页 | 论坛 | 博客
  • 博客访问: 59514
  • 博文数量: 2
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 60
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-14 22:33
文章分类

全部博文(2)

文章存档

2008年(2)

我的朋友
最近访客

分类: C/C++

2008-07-14 09:59:38

M22 GPRS拨号
Example:
Device sends data to server 168.95.100.100 TCP port 1500. Assume the server will response ok after receive data.
Steps:
(1) Use AT command to setup parameters:
APN,
User ID,
Password,
Dest. IP Addr. or DNS name,
Protocol,
Port.
1. AT+CGDCONT=1,"IP","INTERNET NAME" (Set APN, “internet name” change to your local APN)
2. AT%CGPCO=1,"PAP,x,y",1 (x: User ID for GPRS dialup, y: password)
3A. For fixed IP mode:
AT$DESTINFO=”*.*.*.*”,1,1500 (Setup the fixed IP address of remote server, Protocol (1:TCP, 2:UDP), port number)
3B. For DNS mode:
AT$DESTINFO=”*”,1,1500,1 (Setup the DNS name of remote server, Protocol (1:TCP, 2:UDP), port number, the last “1” means DNS mode)
4. AT$NOSLEEP=1
5. ATD*97#
(2) AT Command: “ATD*97#” to dialup GPRS and open TCP/UDP socket
This command will: (1) connects GPRS;
(2) setup TCP connection if protocol =TCP (or UDP);
(3) Switch UART from command mode to data mode.
Command mode means that device can set AT command to module.
Data mode means that device can send and receive Internet packets with raw data.
(3)In data mode : Send and receive Internet packets.
Device sends raw data to GPRS module. The BENQ GPRS module will send the data to the specified remote server by the TCP connection. GPRS module will send data to device after receive data from the server.
(5) the module will change to command mode after device sends “+++” to module by UART.
Device idle one second, send “+++” quickly, and Idle for another one second. Switch UART from data mode to command mode.
Now the device can send “ATO” to change back to data mode.
And the device can send “ATH” to disconnect the TCP connection, then the GPRS will be disconnected, TCP/UDP socket will be closed.
阅读(2057) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~