2017-6-20 20:05:41 [显示全部楼层]
5618浏览
查看: 5618|回复: 6

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

[复制链接]
本帖最后由 GG1101 于 2017-6-20 21:02 编辑

我前天在论坛上下载了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

GG1101  学徒
 楼主|

发表于 2017-6-20 20:08:22

按照道理不会出现这种情况,以至于我用设定的号码的手机打电话都拦截,原因出现 str 上面。里面不是完整的11位手机号码,前面二位18没有,就是只有后面9位。麻烦大神帮我看看,找出原因
回复

使用道具 举报

GG1101  学徒
 楼主|

发表于 2017-6-20 20:50:47

回复

使用道具 举报

GG1101  学徒
 楼主|

发表于 2017-6-20 20:52:09

回复

使用道具 举报

GG1101  学徒
 楼主|

发表于 2017-6-20 20:56:35

图片在上面,拍的不好
回复

使用道具 举报

Robert_Shuai  初级技师

发表于 2017-6-21 15:02:28

打印str的代码直接是 “lcd.print(str);”吗
回复

使用道具 举报

20060606  高级技匠

发表于 2020-8-13 05:33:02

不清楚呀
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
关于楼主
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail