首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >SIM7600CE -如何知道SIM卡何时通过软件注册到网络

SIM7600CE -如何知道SIM卡何时通过软件注册到网络
EN

Stack Overflow用户
提问于 2020-09-10 08:24:04
回答 2查看 555关注 0票数 0

我试图设置SIM7600CE,让它连接到互联网,每当我打开它与阿迪诺梅加。我知道如何通过设置引脚D12来打开它,但是我不知道如何读取网卡的信号才能知道网卡何时开始闪烁,这意味着SIM卡已成功注册到网络中。我能读懂那个信号吗?或者,当SIM卡通过软件成功注册到网络时,是否还有其他方法可以确认?

编辑:我正在尝试通过使用AT命令获取我的SIM7600连接的信息。即使我可以发送AT命令,也不能解析响应。下面代码的结果是,串行不断地打印字符串"at+csq“。有人能帮忙吗?

代码语言:javascript
运行
复制
#define mySerial Serial1
#define PWRKEY 12

void setup() 
{
  digitalWrite(PWRKEY, HIGH);     //Press the boot button
  Serial.begin(115200);
  delay(500);
  mySerial.begin(115200);
  delay(5000);

  while (1)
  {
    Serial.println("AT+CSQ");     //AT command for Signal quality test
    updateSerial();
    delay(1500);
  }
}

void loop() 
{
  updateSerial();
}

void updateSerial()
{
  delay(500);
   while (Serial.available())
  {
    mySerial.write(Serial.read());
  }
  while (mySerial.available())
   {
    Serial.write(mySerial.read());
     if (Serial.find("+CSQ: "))   //Find the AT+CSQ response
    {
      char c = mySerial.read();   
      if (c != '9')               //check the first digit after "+CSQ: ", +CSQ: 99,99 means not detectable, 
      {
        Serial.println("connected");
        break; 
      }
    }
  }
EN

Stack Overflow用户

回答已采纳

发布于 2020-10-20 06:41:48

我用同样的逻辑解决了这个问题。但是,我尝试只在SIM7600系列中进行读写,并在监视器上进行一些打印以指导/调试。此外,我还使用了连接标志作为条件,在连接调制解调器时中断while循环。

代码语言:javascript
运行
复制
#define mySerial Serial1
#define PWRKEY 12

bool connectionFlag = 0; //will be set when connected

void setup() 
{
  digitalWrite(PWRKEY, HIGH);     //Press the boot button
  Serial.begin(115200);
  delay(500);
  mySerial.begin(115200);
  delay(5000);                    //Give it a little time to initialize

  while (1)
  {
    mySerial.println("AT+CSQ");     //AT command for Signal quality test
    connectionCheck();
    if (connectionFlag ==1) break;
    delay(1500);    
  }
  Serial.println("done");
  mySerial.println("AT+CSQ");       //Get the CSQ response to confirm. 
  updateSerial();
}

void loop() 
{
  updateSerial();
}

void connectionCheck()
{
  delay(500);
  while (mySerial.available())
   {
//    Serial.write(mySerial.read());
     if (mySerial.find("+CSQ: "))   //Find the AT+CSQ response
    {
      Serial.print("initializing\t");
      char c = mySerial.read();   
      if (c != '9')               //check the first digit after "+CSQ: ", +CSQ: 99,99 means not detectable, 
      {
        Serial.println("connected");
        connectionFlag = 1;
        break; 
      }
    }
   }
}

void updateSerial()
{
  delay(500);
  if (mySerial.available())
  {
    Serial.write(mySerial.read());
  }
  if (Serial.available())
  {
    mySerial.write(Serial.read());
  }
}
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63825656

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档