This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GSM question

Hi guys please let me know if I can post a question regarding GSM modem over here My modem is working fine just when I try to receive msg through at+cmgr=1
1st character I get is not '+' Its not related to h/w but programming and response of GSM modem for at commands so is it ok if I post my query over here?

Parents
  • Thanks kalib then here is the question: What is the 1st character that I receive after at+cmgr=1 I considered it as '+' as in +CMGR:.... etc.
    However my check for '+' fails Here is the part of code:

    
    sbit p0 = P2^0;
    sbit p1 = P2^1;
    sbit p3 = P2^3;
    sbit p4 = P2^4;
    sbit p5 = P2^5;
    sbit p6 = P2^6;
    
    unsigned char CheckMsg(void)
    {
     unsigned char at_cmgr[] = "at+cmgr=1";
     char Received_Char;
     Command(at_cmgr);
     CR();
     Received_Char = Receive_Char();
     if(Received_Char != '+')
      { p3 = 1; return 0; }
     Received_Char = Receive_Char();
     if(Received_Char != 'C')
      { p1 = 1; return 0; }
     Received_Char = Receive_Char();
     if(Received_Char != 'M')
      { p4 = 1; return 0; }
     Received_Char = Receive_Char();
     if(Received_Char != 'G')
      { p4 = 1; return 0; }
     else return 1;
    }
    
    void Command(unsigned char *at_command)
    {
     unsigned char i;
     i = 0;
     do
     {
      Xmit_Char(at_command+i);
      i++;
     }
     while(at_command[i] != '\0');
     return;
    }
    
    void CR(void)
    {
     Xmit_Static_Char(0x0D);
     return;
    }
    
    

    the function ChkMsg returns 0 even if msg is been received Xmit_Char and Xmit_Static_Char just transmit characters serially they are working correctly on port2 I've connected LEDs so that I can judge the output
    Thanks in advance

Reply
  • Thanks kalib then here is the question: What is the 1st character that I receive after at+cmgr=1 I considered it as '+' as in +CMGR:.... etc.
    However my check for '+' fails Here is the part of code:

    
    sbit p0 = P2^0;
    sbit p1 = P2^1;
    sbit p3 = P2^3;
    sbit p4 = P2^4;
    sbit p5 = P2^5;
    sbit p6 = P2^6;
    
    unsigned char CheckMsg(void)
    {
     unsigned char at_cmgr[] = "at+cmgr=1";
     char Received_Char;
     Command(at_cmgr);
     CR();
     Received_Char = Receive_Char();
     if(Received_Char != '+')
      { p3 = 1; return 0; }
     Received_Char = Receive_Char();
     if(Received_Char != 'C')
      { p1 = 1; return 0; }
     Received_Char = Receive_Char();
     if(Received_Char != 'M')
      { p4 = 1; return 0; }
     Received_Char = Receive_Char();
     if(Received_Char != 'G')
      { p4 = 1; return 0; }
     else return 1;
    }
    
    void Command(unsigned char *at_command)
    {
     unsigned char i;
     i = 0;
     do
     {
      Xmit_Char(at_command+i);
      i++;
     }
     while(at_command[i] != '\0');
     return;
    }
    
    void CR(void)
    {
     Xmit_Static_Char(0x0D);
     return;
    }
    
    

    the function ChkMsg returns 0 even if msg is been received Xmit_Char and Xmit_Static_Char just transmit characters serially they are working correctly on port2 I've connected LEDs so that I can judge the output
    Thanks in advance

Children