EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / GSM interfacing with Atmega16

GSM interfacing with Atmega16

|

Microcontroller › AVR › GSM interfacing with Atmega16

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 2 months ago by Arjun Singh.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • March 8, 2015 at 8:34 pm #3531
    Subhamoy Mahajan
    Participant

    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!='';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("ATr");
    _delay_ms(2000);
    command("ATr");
    _delay_ms(2000);
    command("ATD+919933988118;r");
    _delay_ms(20000);
    command("ATHr");
     
        
     
    while(1)
        {
     
            //TODO:: Please write your application code 
        }
    }
     
     
    Can any one please help me why my atmega is unable to do so or is there any problem in my code?
     
    April 10, 2015 at 4:28 am #12779
    Arjun Singh
    Participant

    Hi Subhamoy

    As i checked your code, i found some errors in it.

    1. write UBRRL=bd; before UBRRH=(bd>>8); as other wise you will discard lower byte.

    2. Write command("ATrn"); instead of command("ATr"); (Enter is required also). 

    3.

    command("ATD+919933988118;r");
    _delay_ms(20000);
     
    you cant give more than 6000 ms of delay from your on delay command.
    So rewrite 6000 here, for more delay you can write _delay_ms(6000); as many times as you required.
     
    Do these modifications,  and tell me the results.
     
  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Parts required for a personal project June 15, 2025
  • Curved lines in PCB design June 15, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz June 15, 2025
  • using a RTC in SF basic June 15, 2025
  • PIC KIT 3 not able to program dsPIC June 15, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise