GSM(SIM-900A)接收英文短信问题
sprintf((char*)p,"AT+CMGR=%s",msgindex);
if(sim900a_send_cmd(p,"+CMGR:",200)!=0)
想从原子哥的程序里改一个收到对英短信就开灯的程序,没有使用LCD屏幕,
sprintf((char*)p,"AT+CMGR=%s",msgindex); 这一句中的msgindex不知道是从哪里获取的,求助,谢谢!
[mw_shl_code=c,true]/*u8 *p,*p1,*p2;
u8 timex=0;
u8 msgindex[3];
u8 msglen=0;
u8 msgmaxnum=0; //¶ìDÅ×î′óìõêy
u8 key=0;
u8 smsreadsta=0; //êÇ·ñÔú¶ìDÅÏÔê¾×′ì¬
p=mymalloc(200);//éêÇë200¸ö×Ö½úμÄÄú′æ
// LCD_Clear(WHITE);
//POINT_COLOR=RED;
//Show_Str_Mid(0,30,"ATK-SIM900A ¶á¶ìDÅ2aêÔ",16,240);
//Show_Str(30,50,200,16,"¶áè¡: ×üDÅÏ¢:",16,0);
//kbd_fn_tbl[0]="¶áè¡";
//kbd_fn_tbl[1]="·μ»Ø";
//sim900a_load_keyboard(0,180,(u8**)kbd_tbl1);//ÏÔê¾¼üÅì
while(1)
{
//key=sim900a_get_keynum(0,180);
//if(key)
/* {
if(smsreadsta)
{
LCD_Fill(30,75,239,179,WHITE);//Çå3yÏÔê¾μĶìDÅÄúèY
smsreadsta=0;
}
if(key<10||key==11)
{
if(msglen<2)
{
msgindex[msglen++]=kbd_tbl[key-1][0];
u2_printf("AT+CLDTMF=2,\"%c\"\r\n",kbd_tbl[key-1][0]);
}
if(msglen==2)
{
key=(msgindex[0]-'0')*10+msgindex[1]-'0';
if(key>msgmaxnum)
{
msgindex[0]=msgmaxnum/10+'0';
msgindex[1]=msgmaxnum%10+'0';
}
}
}else
{
if(key==13)if(msglen)msglen--;//é¾3y
if(key==14&&msglen)//Ö′DD¶á衶ìDÅ
{
LCD_Fill(30,75,239,179,WHITE);//Çå3y֮ǰμÄÏÔê¾
sprintf((char*)p,"AT+CMGR=%s",msgindex);
if(sim900a_send_cmd(p,"+CMGR:",200)==0)//¶á衶ìDÅ
{
POINT_COLOR=RED;
Show_Str(30,75,200,12,"×′ì¬:",12,0);
Show_Str(30+75,75,200,12,"à′×Ô:",12,0);
Show_Str(30,90,200,12,"½óêÕê±¼ä:",12,0);
Show_Str(30,105,200,12,"ÄúèY:",12,0);
POINT_COLOR=BLUE;
if(strstr((const char*)(USART2_RX_BUF),"UNREAD")==0)Show_Str(30+30,75,200,12,"òѶá",12,0);
else Show_Str(30+30,75,200,12,"Î′¶á",12,0);
*/
sprintf((char*)p,"AT+CMGR=%s",msgindex); //Õaàï3öÎêìa
if(sim900a_send_cmd(p,"+CMGR:",200)!=0)//¶á衶ìDÅ
{
// p1=(u8*)sim900a_check_cmd(\"+CMTI:\");
p1=(u8*)strstr((const char*)(USART2_RX_BUF),",");
p2=(u8*)strstr((const char*)(p1+2),"\"");
p2[0]=0;//¼óèë½áêø·û
// sim900a_unigbk_exchange(p1+2,p,0); //½«unicode×Ö·û×a»»ÎagbkÂë
// Show_Str(30+75+30,75,200,12,p,12,0); //ÏÔê¾μç»°oÅÂë
p1=(u8*)strstr((const char*)(p2+1),"/");
p2=(u8*)strstr((const char*)(p1),"+");
p2[0]=0;//¼óèë½áêø·û
// Show_Str(30+54,90,200,12,p1-2,12,0); //ÏÔê¾½óêÕê±¼ä
p1=(u8*)strstr((const char*)(p2+1),"\r"); //Ñ°Õò»Ø3μ·û
if(p1+2) { LED0=!LED0;}
// if(strstr((const char*)(p1+2),\"on\"))
// sim900a_unigbk_exchange(p1+2,p,0); //½«unicode×Ö·û×a»»ÎagbkÂë
// Show_Str(30+30,105,180,75,p,12,0); //ÏÔ꾶ìDÅÄúèY
// smsreadsta=1; //±ê¼ÇóDÏÔ꾶ìDÅÄúèY
else
{LED1=!LED1;}
} */[/mw_shl_code]
|