资源描述:
《gprs-gsm程序》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、//=====GPRSMODULEPROGRAM=============//==FROM2003.9.=======================//=======bycfj========================#include//#include#include#include#include#include#include#defineUintunsignedint#define_3NOP()_NOP();_NOP();
2、_NOP();#define_4NOP()_NOP();_NOP();_NOP();_NOP();#define_5NOP()_NOP();_NOP();_NOP();_NOP();_NOP();#defineEstart_Addr0//0EEprom起始地址#defineWork_Mode_AddrEstart_Addr+6//6工作模式设置:1字节#defineMAPN_AddrWork_Mode_Addr+1//7移动网关接入点名称:20字节ASCI#defineDSC_Ip_AddrMAPN_Addr+20//27数据服务中心IP地址:12字节ASC#defineDSC_Por
3、t_AddrDSC_Ip_Addr+12//39数据中心端口:5字节ASCII#defineNet_Protocol_AddrDSC_Port_Addr+5//44网络数据传输协议#defineTerminal_SIM_AddrNet_Protocol_Addr+1//45终端SIM#defineBeat_AddrTerminal_SIM_Addr+11//56心跳周期地址#definePassWord_AddrBeat_Addr+1//57设置密码#defineSCA_SIM_AddrPassWord_Addr+6//63短信服务中心号码#defineDSC_SIM_AddrSCA_
4、SIM_Addr+11//74数据中心号码#defineBackUp_AddrDSC_SIM_Addr+11//85备用#defineSet_CrcBackUp_Addr+4//89CRC校验码#defineEstart2_AddrEstart_Addr+100//******************************************************************//函数:main()//功能:主函数//输入参数://输出参数://==============================================================
5、================//常量定义//==============================================================================char*AT="ATr";//AT命令用于检测GPRS是否存在或开机。charAT_Echo[12]={'A','T','E','=','0','V','=','1','&','D','1',0X0D};//命令码不返回。//char*AT_Echo="ATE=0V=1&D1r";//命令码不返回。char*AT_O="ATOr";//从命令状态返回到数据状态。char*AT_
6、3Plus="+++ATr";char*AT_W="AT&Wr";//保存设置。char*AT_ActivateIp="AT*E2IPA=1,1r";charOpenIp[11]={'A','T','*','E','2','I','P','O','=','1',',',};char*AT_CloseIp="AT*E2IPCr";//关闭GPRS通道char*AT_CMGF="AT+CMGF=0r";//短信PDUMODEcharTerminal_Command[19]={0x68,0x0d,0x0d,0x68,0x4a,0x99,0x99,0x07,0x00,0x0b,0x8
7、0,0x30charEcho_Array[]={0X2F,0X00,0X07,0XFF,0XFF,0XFD,0XA3,0X03};//设置正确信号charAlarm_Switch_Echo[]={0X2F,0X00,0X08,0XFF,0XFF,0XCE,0XEC,0X8F,0X14};charData_Switch_Echo[]={0X2F,0X00,0X08,0XFF,0XFF,0XCD,0XEC,0XDA,0X47};//========