Doubt in GSM sim900 interfacing with atmega16

Status
Not open for further replies.

Thread Starter

shubh agrawal

Joined Mar 9, 2015
4
Right now I am trying a simple code of calling by GSM sim900 using atmega16
MY SETUP:Rx and Tx pins of atmega board are connected to Tx and Rx of my GSM modem and also to my uart bridge which i connect to my PC(done by splitting the Rx and Tx pins)-This was done so i could know whether my AT commands were given to modem or not

OBSERVATION;

AT commands appeared as i wanted in terminal(X-CTU I have Used) that means they were actually given to modem also(since i splitte the wires).But no call was made.However when i myself entered the AT commands During the same process I was succesful

MY code:

#define F_CPU 12000000UL
#include <util/delay.h>
#include <avr/interrupt.h>
#define BAUD 38400 //setting up baud rate
#define bd (int)(F_CPU/16/BAUD-1) //value of UDRR to be set
#include <avr/io.h>
void command(char*a) //function to send a string using pointers
{
int i;
for(i=0;a!='\0';i++)
{
while(!(UCSRA&(1<<UDRE)));
UDR=a;
_delay_ms(100);
}

}
flush ISR (USART_RXC_vect) //flushing any type of echoes obtained
{
char recdata;
recdata=UDR;
}
int main(void)
{
sei();
UBRRH=(bd>>8);
UBRRL=bd;
UCSRB|=1<<RXEN|1<<TXEN|1<<RXCIE;
UCSRC|=1<<URSEL|1<<UCSZ0|1<<UCSZ1;


_delay_ms(2000);
command("AT\r");
_delay_ms(2000);
command("AT\r");
_delay_ms(2000);
command("ATD+919933988118;\r");
_delay_ms(20000);
command("ATH\r");



while(1)
{


}
}


Can any one please help me why my atmega is unable to do so or is there any problem in my code?
 
Status
Not open for further replies.
Top