新手入门
- 积分
- 36
- 金钱
- 36
- 注册时间
- 2015-9-24
- 在线时间
- 0 小时
|
5金钱
ALIENTEK MiniSTM32 扩展实验25 ATK-SIM900A GSM模块测试实验中下面程序为何实现不了
//sim900a短信测试
//用于读短信或者发短信
//返回值:0,正常
// 其他,错误代码
u8 sim900a_sms_test(void)
{
u8 key;
u8 timex=0;
if(sim900a_send_cmd("AT+CMGF=1","OK",200))return 1; //设置文本模式
if(sim900a_send_cmd("AT+CSCS=\"UCS2\"","OK",200))return 2; //设置TE字符集为UCS2
if(sim900a_send_cmd("AT+CSMP=17,0,2,25","OK",200))return 3; //设置短消息文本模式参数
sim900a_sms_ui(40,30);
while(1)
{
key=KEY_Scan();
if(key==1)
{
sim900a_sms_read_test();
sim900a_sms_ui(40,30);
timex=0;
}else if(key==2)
{
sim900a_sms_send_test();
sim900a_sms_ui(40,30);
timex=0;
}else if(key==3)break;
timex++;
if(timex==20)
{
timex=0;
LED0=!LED0;
}
delay_ms(10);
sim_at_response(1); //检查GSM模块发送过来的数据,及时上传给电脑
}
sim900a_send_cmd("AT+CSCS=\"GSM\"","OK",200); //设置默认的GSM 7位缺省字符集
return 0;
}
|
|