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 / Replies /   //Thanks ‘Ajish Alfred’ 

  //Thanks ‘Ajish Alfred’ 

|

Microcontroller › AVR › By using GSM SIM 300M and Atmega8 , How to write coding for sending SMS to 3 Persons when any one the port pin gets high …? ›   //Thanks ‘Ajish Alfred’ 

November 6, 2012 at 9:56 am #8711
5HUJ4
Participant

 

 

//Thanks ‘Ajish Alfred’  for ur suggestion .Here is the exact code which i have modified to, but still i am not gettting SMS . Plz can u find out the problrm and suggest me the correct coding ………. i am really ineed of it  : (

 

//Eagerly Waiting for ur reply …………..!!

 

#include<avr/io.h>
#include<util/delay.h>
#define F_CPU 12000000UL
#define USART_BAUDRATE 9600 // Baud Rate value
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) – 1)
#define PIN PB0
void usart_putstr(char * s);
void usart_init();
static void usart_putch(unsigned char send);
unsigned int usart_getch();

int main ()

{
DDRD|=0xFC;//Setting the Tx and Rx Pins Low
   while (1)
   {
   while (PIN==0); //program will loop in this line itself only until the pin become logic high
    
      usart_init(); // initialization of USART
      char b[] = “AT+CMGS=”;
      char no[]=”+918000000000″;
      char body[] =”Got the Output”; 
    {
     usart_putstr(b);
     _delay_ms(100);
     usart_putch(‘”‘);
     usart_putstr(no);
     _delay_ms(100);
     usart_putch(‘”‘);
     _delay_ms(100);
     usart_putch(‘r’);
     usart_putch(‘n’);
     _delay_ms(100);
     usart_putstr(body);
     _delay_ms(100);
     usart_putch(0x1A);
    }
    return 0;
 
   }
}

void usart_init()
    {
    UBRRL = 0x47;
    _delay_ms(1);
    UCSRB |= (1 << RXEN) | (1 << TXEN);   // Turn on the transmission and reception circuitry
    UCSRC |= (1 << URSEL) | (1<<USBS) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes
    }
 
unsigned int usart_getch()
    {
    while (!(UCSRA & (1 << RXC)) ); // Do nothing until data has been received and is ready to be read from UDR
    _delay_ms(1);
    return(UDR); // return the byte
    }
 

static void usart_putch(unsigned char send)
    {
 
    while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready..
    // for more data to be written to it
    UDR = send; // Send the byte
    }
 

void usart_putstr(char * s)
    {
      while(*s)
          {
            usart_putch(*s++);
          }
    }

RSS Recent Posts

  • how to work on pcbs that are thick May 18, 2025
  • Actin group needed for effective PCB software tutorials May 18, 2025
  • Kawai KDP 80 Electronic Piano Dead May 18, 2025
  • Doing consultancy work and the Tax situation? May 18, 2025
  • How to repair this plug in connector where wires came loose May 17, 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