Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Gsm interfacing with atmega16

Status
Not open for further replies.

ANTI_HACKER

Member level 3
Joined
Sep 1, 2012
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,722
Hello everyone!
I am working on GSM sim900D interfacing with Atmega16. Initially I made the circuit using MAX232 on breadboard. Then i connected it to my PC using a serial port. I tested AT commands, the commands worked perfectly on hyper terminal and i was able to send sms using hyperterminal. Then I tested it on Proteus and it was working there perfectly too. I am using codevision avr as the compiler. GSM work on 9600baud but the problem is that in compiler i have to keep the baud rate4800(clock = 1MHz) and at proteus COMPIM(physical baud=9600 & virtual baud=4800) only then it works when i run it on hardware(breadboard) it doesn't work as i have set the baud to 4800. I dont know how to set the baud for hardware. I tried 9600baud for hardware in compiler but it doesnot send sms at all. Kindly tell what should i do?
Thanks in advance
 

Code:
//atmega 16  UART  
//////////////////UART CONFIG/////////////////
SREG|=0X80;
DDRD =0XFE;
UCSRB=0x98;    //8BIT //1 STOP BIT //NO PARITY //RXCIE ENABLE
UCSRC=0x86;    //ASYNC  
UBRRH=0x0;  
UBRRL=0x47;    //BDRT 9600     Xtal  11.0592Mhz
 

As u are using 1MHz clock , use 4800 baud as i use... In Proteus Set physical and virtual both to 4800. but before doing that change the baud-rate of sim900D using the command AT+IPR=4800 <CR>

The problem you are facing is because the SIM900d is set to 9600 , and micro controller set to 4800. IN Proteus you are converting that 4800 to 9600 ,,, but in your circuit you are not doing it . using 1MHz means u have to choose 4800.


another solution is change your clock to 8Mhz and baudrate to 9600 on Microcontroller.
 

replace the crystal to 11.0592MHz & calculate the 9600 baud rate load that value. then check it.
 

I tried changing the baud to 4800 with 1MHz clock but still its not working on breadboard :(
Now I'm checking by changing crystal to 8MHz *fingers crossed*

- - - Updated - - -

I tried(in simulation proteus) by changing baud to 9600 and clock to 8MHz & 11.0592MHz but none of it work. It should first work in simulation then on breadboard what should i do now?

- - - Updated - - -

Please help what should i do to get over it?
 
Last edited:

gs is communication is at 9600 baud rate.

- - - Updated - - -

sorry gsm is communication is at 9600 baud rate.
 

still not working :(
can anyone tell me exactly which crystal to use with what baud?
 

crystal is value is 11.0592MHz & its baud rate is 9600. load value for this baud rate calculated value is fine.
 

the problem seemed to be pretty straight forward ...

please upload your schematic and hex file along with source code , so that I can check and correct it for you.
 

This is my code here please check it and guide me through this..
I have communicated through 4800
but I am having problem with 9600 baud
kindly tell me the clock value and and the baud values of the terminal and com port in proteus
please.. i am waiting

Code:
#include <mega16.h>
#include <delay.h>

#define F_CPU 8000000UL
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)



#define rs PORTD.2 // defining rs pin to be PORTC.O
#define rw PORTD.3 //defining rs pin to be PORTC.1
#define en PORTD.4 //defining en pin to be PORCT.2

int j,msg_rcd,count,NUMBER;
unsigned char data,message_no,;
long i,z,speed_mph;
unsigned char rec_rfid[20],speed_kph[15],speed_knots[15],validation,utc_time[15], UTC[15],lati_value[15], LATITUDE[15],lati_dir, longi_value[15], LONGITUDE[15],longi_dir ;



 void init_USART(void)
{
    UCSRA = 0x00; //control register initialization
    UCSRB = 0x18; //enable transmitter and Rx   and rx interrupt
    UCSRC = 0x86; //async, no parity, 1 stop bit,
    
    UBRRL = BAUD_PRESCALE; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
    UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
    
}






void USART_Rx() 
{ 
    while((UCSRA & 0x80)==0x00); //wait for RXC flag       
    data = UDR;
}




void USART_Tx(char DATA) 
{ 
    while((UCSRA & 0x20)==0x00); //wait for UDRE flag
    UDR = DATA; //load data to UDR for transmission
     
}







  
void main()
{

    DDRA=0XFF;
    DDRD.2=1;
    DDRD.3=1;
    DDRD.4=1;

    
 
    init_USART();
    
    
    
    
    while(1)
    {
        USART_Tx('A');
        USART_Tx('T');
        USART_Tx('\r'); 
        delay_ms(1500);
    }
    
     

}
 

Attachments

  • GSM.rar
    12.9 KB · Views: 64

the first thing to do is to change the clock of ur microcontroller in proteus F_CPU wont chnage it , do it in object proprties Untitled.png

also if your device is not set to AUTO BAUD you have to either set it to AUTO BAUD or Fixed baud. I guess it is auto baud so you dont need to worry , IN case the above step doest help check the baud rate and set it to auto baud.
 

sir,could you please send me that circuit in Proteus,for our project.our diagram is not working
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top