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

sending msg

Hi guys I read the topics about interfacing 8051 with gsm modem those are really helpful However when I implemented my program to receive a msg and give an acknowledgment(through sms) for same There went something wrong : While sending my sms modem doesn't send 1st 8 characters of my msg i.e. Consider example:

unsigned char *msg = "abcdefghijklmnop"

then my msg sending routine tend to send ijklmnop thats all can anybody help Thank you

Parents
  • Sorry for incomplete information here is a part of code its only part of not whole so let me know if thats insufficient:

    unsigned char *Ack_ON1="Device iDevice is turned ON$";           //1st 8 chars. are not xmitted
    unsigned char *at_cmgs = "at+cmgs=\"+9199xxxxxxxx\"$";  //to send ack to this no.
    
    Cmd(at_cmgs);
    CR();
    XMIT(Ack_ON1);
    Cnt_Z();
    
    
    void XMIT(unsigned char *msg)
     {
      unsigned char i;
      i = 0;
      do
       {
        ACC = msg[i];
        SBUF = ACC;
        while(TI == 0){}
            TI = 0;
            i++;
       }
      while(msg[i] != '$');
      return;
     }
    
    void Cmd(unsigned char *at_command)
     {
      unsigned char i;
      i = 0;
      do
       {
        ACC = at_command[i];
        SBUF = ACC;
        while(TI == 0){}
            TI = 0;
            i++;
       }
      while(at_command[i] != '$');
      return;
     }
    
    void CR(void)
      {
       SBUF = 0x0D;           //0x0D CR
       while(TI == 0){}
       TI = 0;
       return;
      }
    
     void Cnt_Z(void)
      {
       SBUF = 0x1A;
       while(TI == 0){}
       TI = 0;
       return;
      }
    
    


    I hope this much would be sufficient what else i've done in code is
    i. receiving the msg
    ii. verifying it
    iii. taking action
    iv. sending acknowledgment msg

Reply
  • Sorry for incomplete information here is a part of code its only part of not whole so let me know if thats insufficient:

    unsigned char *Ack_ON1="Device iDevice is turned ON$";           //1st 8 chars. are not xmitted
    unsigned char *at_cmgs = "at+cmgs=\"+9199xxxxxxxx\"$";  //to send ack to this no.
    
    Cmd(at_cmgs);
    CR();
    XMIT(Ack_ON1);
    Cnt_Z();
    
    
    void XMIT(unsigned char *msg)
     {
      unsigned char i;
      i = 0;
      do
       {
        ACC = msg[i];
        SBUF = ACC;
        while(TI == 0){}
            TI = 0;
            i++;
       }
      while(msg[i] != '$');
      return;
     }
    
    void Cmd(unsigned char *at_command)
     {
      unsigned char i;
      i = 0;
      do
       {
        ACC = at_command[i];
        SBUF = ACC;
        while(TI == 0){}
            TI = 0;
            i++;
       }
      while(at_command[i] != '$');
      return;
     }
    
    void CR(void)
      {
       SBUF = 0x0D;           //0x0D CR
       while(TI == 0){}
       TI = 0;
       return;
      }
    
     void Cnt_Z(void)
      {
       SBUF = 0x1A;
       while(TI == 0){}
       TI = 0;
       return;
      }
    
    


    I hope this much would be sufficient what else i've done in code is
    i. receiving the msg
    ii. verifying it
    iii. taking action
    iv. sending acknowledgment msg

Children