Unable to Send Multiple Messages using SIM 800 /900 .

  1. shashidhar1990
    shashidhar1990
    hi
    SIM 800 while sending the sms of size 120 characters get error response when recipients.
    are more than 5. I have provided delay of 1 Second between 2 messages.


    i am using 19200 buad rate , 8-N-1 frame format.
    sending single messages works well.


    what is the standard delay to be specified while sending between SMS's of length 100+ characters?
    Is there initial set up to be done in gsm sim800 for specifying buffer size etc
    while sending sms in burst to several numbers?
    let me if there are any bugs in code?

    my code is as fallows :

    #ifndef F_CPU
    #define F_CPU 7372800UL
    #endif

    #include <avr/io.h>
    #include <util/delay.h>
    #include <inttypes.h>
    #include <avr/interrupt.h>
    #include <avr/pgmspace.h>
    #include <avr/sleep.h>
    #include <string.h>
    #define Ctrl_Z 26
    #define LF 0x0A
    #define CR 0x0D
    #define DOUBLE_QUOTATION_MARK 0x22
    #define ledon PORTC|=(1<<PC0)
    #define ledoff PORTC&=~(1<<PC0)



    void usart_init(unsigned int bd) // USART initialization
    {
    UCSRA = 0x00;
    /* Set baud rate */
    UBRRH = (unsigned char)(bd>>8);
    UBRRL = (unsigned char)bd;
    /* Enable receiver and transmitter */
    UCSRB = (1<<RXEN) | (1<<TXEN);
    /* Set frame format: 8data, 1stop bit */
    UCSRC = (1 << URSEL) | (0<<USBS) |(3<<UCSZ0);
    }

    void usart_transmit( unsigned char data)
    {
    while (!( UCSRA & (1<<UDRE)))
    UDR = data;
    _delay_ms(30);
    }


    void sendcommand_PSTR(const char *string)
    {
    _delay_ms(10);
    while (pgm_read_byte(&(*string)))
    {
    usart_transmit(pgm_read_byte(&(*string++)));
    _delay_ms(10);
    }
    }

    void sendcommand(char *string)
    {
    unsigned int j=0;
    _delay_ms(10);
    while (string[j] != '\0')
    {
    usart_transmit(string[j]);
    j++;
    _delay_ms(10);
    }
    }

    gsm_init()
    {
    sendcommand_PSTR(PSTR("ATE0")); // Send AT+CMGF=1 to GSM
    usart_transmit(CR);
    usart_transmit(LF);
    _delay_ms(100);
    sendcommand_PSTR(PSTR("AT+CMGF=1")); // Send AT+CMGF=1 to GSM
    usart_transmit(CR);
    usart_transmit(LF);
    _delay_ms(100);
    sendcommand_PSTR(PSTR("AT+CSMP=49,167,0,0")); // AT+CSMP=49,167,0,0 // For msg Delivery report --> AT+CSMP=49,167,0,0
    usart_transmit(CR);
    usart_transmit(LF);
    _delay_ms(100);
    sendcommand_PSTR(PSTR("AT+CNMI=2,2,0,1,0")); // For msg received report
    usart_transmit(CR);
    usart_transmit(LF);
    _delay_ms(100);
    sendcommand_PSTR(PSTR("AT&W")); // SAVE THE SETTINGS SENT
    usart_transmit(CR);
    usart_transmit(LF);
    _delay_ms(100);

    }
    void main(const char *command)
    {
    usart_init(23);
    _delay_ms(1000);
    gsm_init();
    for(int i=0; i<5; i++)
    {
    sendcommand_PSTR(PSTR("AT+CMGS="));
    usart_transmit(DOUBLE_QUOTATION_MARK);
    sendcommand("9535500642");
    usart_transmit(DOUBLE_QUOTATION_MARK);
    usart_transmit(CR);
    usart_transmit(LF);
    sendcommand_PSTR(PSTR("MARY HAD A LITTLE LAMBMARY HAD A LITTLE LAMBMARY HAD A LITTLE LAMBMARY HAD A LITTLE LAMBMARY HAD A LITTLE LAMBMARY HAD A LITTLE LAMB"));
    usart_transmit(Ctrl_Z);
    _delay_ms(1000);
    }
    }
Results 1 to 1 of 1