void Caixin_fa(void)
{
uint16_t i;
UART4_printf(UART4,"ATI\r");
Delay_ms(500);
UART4_printf(UART4,"AT+CPIN?\r");
//查询SIM卡状态,正常+CPIN:READY
Delay_ms(500);
UART4_printf(UART4,"at+cmmsinit\r");
//初始化彩信
Delay_ms(500);
UART4_printf(UART4,"at+cmmscurl="mmsc.monterner.com"\r");
//配置中国移动手机彩信中心地址
Delay_ms(500);
UART4_printf(UART4,"at+cmmscid=1\r");
//设置承载上下文ID
Delay_ms(500);
UART4_printf(UART4,"AT+CMMSPROTO=1"10.0.0.172",80\r");
//设置mms协议属性
Delay_ms(500);
UART4_printf(UART4,"at+cmmssendcfg=6,3,0,0,2,4\r");
//设置mms的发送参数
Delay_ms(500);
/**/ UART4_printf(UART4,"at+sapbr=3,1,"contype","gprs"\r");
Delay_ms(500);
/**/ UART4_printf(UART4,"at+sapbr=3,1,"apn","cmwap"\r");
Delay_ms(500);
/**/ UART4_printf(UART4,"at+sapbr=1,1\r");
Delay_ms(500);
/**/ UART4_printf(UART4,"at+sapbr=2,1\r");
Delay_ms(500);
UART4_printf(UART4,"at+cmmsedit=0\r");
//关闭编辑状态,这样在模块的buff区的数据将被删除
Delay_ms(500);
UART4_printf(UART4,"at+cmmsedit=1\r");
//打开编辑状态,这个状态才可以发送mms
Delay_ms(1000);
UART4_printf(UART4,"at+cmmsdown="pic",4004,100000\r");
//设置发送的图片的大小(byte)和需要用来传输的时间100000ms,4051这个
Delay_ms(1000);
for(i=0;i<4004;i++) //while(i<sizeof(hua))
{
UART4_Send_Byte(dsp_picture[i]);
}
UART4_printf(UART4,"\r");
//结束符号
Delay_ms(1000);
UART4_printf(UART4,"at+cmmsdown=\"title\",12,10000\r");
//设置发送的mms的名字,大小,时间
Delay_ms(500);
UART4_printf(UART4,"ZhiNengJiaJu");
//发送名字,hua
Delay_ms(500);
UART4_printf(UART4,"at+cmmsdown=\"text\",8,10000\r");
//设置发送的mms的文本内容,小于1000bytes
Delay_ms(500);
UART4_printf(UART4,"picture!");
//文本内容
Delay_ms(500);
UART4_printf(UART4,"at+cmmsrecp=\"15034155113\"\r");
Delay_ms(500);
UART4_printf(UART4,"at+cmmsview\r");
//查看发送的内容是否已经存入模块
Delay_ms(500);
UART4_printf(UART4,"at+cmmssend\r");
//发送mms
Delay_ms(10000);
UART4_printf(UART4,"AT+CMMSEDIT=0\r");
//关闭编辑状态
Delay_ms(500);
}
void Duanxin_fa(void)
{
UART4_printf(UART4,"ATI\r");
Delay_ms(200);
UART4_printf(UART4,"AT+CNMI=2,1\r");
//短信提示,状态有OK回复
Delay_ms(200);
UART4_printf(UART4,"AT+CMGF=1\r");
//英文方式发送,状态有OK回复
Delay_ms(200);
UART4_printf(UART4,"AT+CMGS=\"18535125132\"\r");
//发送接收的手机号码,样例AT+CMGS="18622944083"
Delay_ms(200);
UART4_printf(UART4,"HELLO!");
puts(&end_char); //以0x1a来结束,表示内容结束,发送短信
}
修改波特率: AT+IPR=115200
查询信号强度:AT+CSQ (返回+CSQ:23,0表示信号强度23)
(十六进制41 54 2B 43 53 51 0D)
SIM卡厂商: AT+COPS? (+COPS: 0,0,"CHN-UNICOM"表示中国联通)
收到信息返回:+CMTI:"SM",1(1表示信息在第一条)
读取英文短信:AT+CMGR=X (x表示信息在第x条,此处为1)
回车:0x0D
换行:0x0A