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。出现这种情况不知怎么回事。 ![]() |





