[moved] problem with gsm based project

Status
Not open for further replies.

balvendrajat

Newbie level 5
Joined
Dec 3, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Bhilwara, India
Activity points
81
hello i am balvendra choudhary
i made a gsm based project in which i used atmega32 A and gsm sim900. in which response of AT command is OK. when i calling it shows RING on display. during calling the status would be three but its not what is the problem. same code is working with sim300 what is the problem
i am writing code here


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "uart_lib.h"
#include "string.h"
#define Asize 30
unsigned char mob[10]="          ";
int index=0,a=0,b=0;
char A[Asize]="jfnnffkngpfmg",status=0,line=0;
ISR(USART_RXC_vect)
{
    char c=UDR;
        if(index<16)
            A[index]=c;
        index++;
        if (c==0x0A)
        {
            status|=1;
            index = 0;
            line=0;
            }
 
        else if(index == 5)
        {
                 if((strncmp(A,"+cmti",5) == 0))
                 {
                     status|=4;
                     line=1;
                     }
            else if((strncmp(A,"+clip",5) == 0))
            {
                status|=2;
                line=1;
                }
            else if((strncmp(A,"NO CA",5) == 0))
            {
                status&=~2;
                line=1;
                }
        }
        else if(index>11&index<22&(status>>1))mob[index-12]=c;
    }
int main(void)
{
 
    set_uartbaud(9600);
    enable_uart_rxcint();
    LCDinit();
    LCDclr();
    sei();
    _delay_ms(2000);
    _delay_ms(2000);
    _delay_ms(2000);
      _delay_ms(2000);
      _delay_ms(2000);
    sendstring_uart("AT\r\n");
    sendstring_uart("at+clip=1\r\n");
    _delay_ms(2000);
 
    while(1)
    {
        if(status==3)
        {
            _delay_ms(500);
            if(status>>1&(strncmp(mob,"**********",10) == 0))
                                        {
                                        _delay_ms(2000);
                                        _delay_ms(2000);
                                        _delay_ms(2000);
                                        _delay_ms(2000);
                                        sendstring_uart("ATH\r\n");
                                        _delay_ms(2000);
                                        status=1;
 
             }
        }
        LCDGotoXY(0,0);
            LCDstring(A,16);
            LCDGotoXY(0,1);
            LCDsendChar(status+48);
            LCDsendChar(30);
            LCDstring(mob,10);
    }
}

 
Last edited by a moderator:

Dear Balvendra,
How are you sending data using sim 900 ? As per my knowledge Each message received by SIM900 module is start with “+CMT” and after that it has the mobile number of the sender and at the end lies the body of the message.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…