Maker Pro
Maker Pro

problem with reciving answer from sim800

STP.Asghari

Nov 22, 2022
7
Joined
Nov 22, 2022
Messages
7
When I give the AT command to the module. The module should give me the answer AT\r\nOK\r\n but to my surprise it gives the answer AT\r\r\nOOK\r\n. I understood this problem by getting the answer from the code below. While if I delete the wrong lines from the code below, the module does not respond.
C:
Send_AT();
    do
    {
      buffer=get_char();
    }while(buffer!='A');
   
   
        buffer=get_char();
        if(buffer=='T')
                   {
                       buffer=get_char();
               if(buffer=='\r')
                          {
                             buffer=get_char();
                             if(buffer=='\r')
                                  {                            
                                      buffer=get_char();
                                      if(buffer=='\n')
                                              {
                                                  buffer=get_char();
                                                   if(buffer=='O')
                                                           {
                                                                 if(buffer=='O')
                                                                    {
                                                                           buffer=get_char();
                                                                           if(buffer=='K')
                                                                                {
                                                                                     buffer=get_char();
                                                                                     if(buffer=='\r')
                                                                                           {                                                                                            
                                                                                             buffer=get_char();
                                                                                             if(buffer=='\n')
                                                                                                    {                                                                                  
                                                                                                                   for(i=0;i<5;i++)
                                                                                                                    {
                                                                                                                            HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,GPIO_PIN_SET);
                                                                                                                            HAL_Delay(500);      
                                                                                                                            HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,GPIO_PIN_RESET);
                                                                                                                            HAL_Delay(500);
                                                                                                                    }
                                                                                                    }
                                                                                           }
                                                                                }
                                                                    }
                                                           }
                                              }
                                  }                      
                          }      
                   }
 
Last edited by a moderator:
Top