SIM800H库使用出现问题,麻烦进来看一下

2017-06-201.5万
AI 快速预览详细 收起
本文介绍了SIM800H库在来电显示功能中的问题排查过程。用户发现来电显示号码不完整,只有9位而不是11位。通过LCD1602打印str发现号码前两位缺失。文章详细描述了问题现象,并提供了排查和解决方法。


我前天在论坛上下载了SIM800H库文件,在使用 使能来电显示例程 的时候出现问题。用设定的号码手机打电话给SIM800H也打不通,后来我通过LCD1602打印 str 发现问题所在[mw_shl_code=c,true]#include <sim800cmd.h>

//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug1);



//phone number buffer
char str[15] = {'\0'};

//the setup routine runs once when you press reset:
void setup()
{
    //initialize the digital pin as an output.
   
    //initialize SIM800H,return 1 when initialize success.
    while((sim800demo.sim800init()) == 0);
    //enable SIM800H Modular Caller ID
    sim800demo.DisplayPhoneNumber(OPEN);
}

//the loop routine runs over and over again forever:
void loop()
{
  
  
}
//application callback function
//Note that not too much to handle tasks in this function
void fundebug1(void)
{
  //get the phone number
  sim800demo.getCallnumber(str);

  if(memcmp(str,"18668603728",11) == 0)
  {
    sim800demo.answerTelephone(); //answer
  }
  else
  {
    sim800demo.cancelCall();//hangs up
  }

}[/mw_shl_code]

我用LCD1602打印出 str ,发现11位号码只显示了9位,前面的两位没有。根本不是11位完整的号码,而是668603728。出现这种情况不知怎么回事。

SIM800H库使用出现问题,麻烦进来看一下图1

创作许可协议

本项目采用 None(不开放任何权利,保留所有权利) 进行许可。

评论(6)
20060606
20060606
不清楚呀
Robert_Shuai
Robert_Shuai
打印str的代码直接是 “lcd.print(str);”吗
GG1101
GG1101
作者
图片在上面,拍的不好
GG1101
GG1101
作者
GG1101
GG1101
作者
GG1101
GG1101
作者
按照道理不会出现这种情况,以至于我用设定的号码的手机打电话都拦截,原因出现 str 上面。里面不是完整的11位手机号码,前面二位18没有,就是只有后面9位。麻烦大神帮我看看,找出原因
- 没有更多了 -