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 / Interfacing of GSM SIM908 and 89v51rd2

Interfacing of GSM SIM908 and 89v51rd2

|

Microcontroller › 8051 › Interfacing of GSM SIM908 and 89v51rd2

  • This topic has 2 replies, 2 voices, and was last updated 11 years, 4 months ago by Amit Raijade.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 20, 2014 at 9:27 am #2818
    Amit Raijade
    Participant

    Hello frnds..

     

    I m doing a small project on sending SMS through above mentioned modules

    I m using 8051 development board made by nskelectronics.

     

    My hardware connections:-

     

    RX of 908 to TX of Controller. and vice versa.

     

    My Queries:-

     

    1>  Is there more connection to do?

    2> Should i bypass max232 IC from board?

    3> How to check OK response after every AT command?

     

    My code:-

     

    #include <reg51.h>
    #include <stdio.h>
     
    sbit BIT1 = P0^0;
    sbit BIT2 = P0^1;
     
    char phone_number1[13]= “+9197xxxxxxxx”;        
    char phone_number2[13]= “+9197xxxxxxxx”;
    char msg1[10] = “HELLO”
    char msg2[10] = “SYSTEM”;
     
     
    char aux_string[20];
    void delay_ms(unsigned int);
    void send_sms(char[],char[]);
     
     
    void serial_init() {
    SCON=0x50; //setup for 8-bit data
    TMOD=0x20; //setup timer 1 for auto-reload
    TH1=0xfd; //Baud Rate 9600
    TR1=1; //turn on timer 1
    //TI=1; //indicate ready to transmit
    }
     
    void send_serial(unsigned char *s){
    while (*s != 0x0){
     
    SBUF = *s;
    while (!TI){
     
    }
    TI = 0;
    s++;
    }
    }
     
    void main(){
    BIT1 = 1;
         BIT2 = 1;
    delay_ms(800);
    serial_init(); //Initialize Serial port.
     
    if(BIT1 == 1){
     
    send_sms(phone_number1,msg1);
    }
     
    else if(BIT2 == 1){
     
    send_sms(phone_number2, msg2);
    }
    else{
    send_serial(“check pin statusn”);
    }
    }
     
    void delay_ms(unsigned int iTime){
    unsigned int i,j;
    for(i = 0 ; i < iTime ; i++)
    for(j = 0 ; j < 1275 ; j++);
    }
     
    void send_sms(char phone_number[],char msg[]){
    send_serial(“ATr”);
    delay_ms(2000);
     send_serial(“AT+CREG=1r”);
    delay_ms(2000);
     send_serial(“AT+CMGF=1r”);
    delay_ms(2000);
    sprintf(aux_string,”AT+CMGS=”%s””, phone_number);
     send_serial(aux_string);
     send_serial(“r”);
    delay_ms(2000);
    send_serial(msg);
     send_serial(“r”);
    delay_ms(2000);
    send_serial(“0x1Ar”);
    delay_ms(3000);
    }
     

     

     

    January 21, 2014 at 7:16 am #10872
    AJISH ALFRED
    Participant

    Hi Amit,

     

    1>  Is there more connection to do?

    Connect the ground lines together.

     

    2> Should i bypass max232 IC from board?

    If you are connecting the gsm module through db9 connector then you must use max232 at the microcontroller end.

     

    3> How to check OK response after every AT command?

     

    Take this piece of code,

    send_serial(“ATr”);
    delay_ms(2000);
     
    Instead of using a delay, try something like this;
     
    while ( strcmp( “OK” == receive_serial_string () ) );
     
    where, “receive_serial_string ()” is a function which you have to write, that can read a string from the serial port. The statement will loop there itself until the received string matches with the required sting “OK”
    January 21, 2014 at 10:07 am #10874
    Amit Raijade
    Participant

    thank you Ajish..

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Siemens large industrial PLC parts June 15, 2025
  • Parts required for a personal project June 15, 2025
  • Cant log in to Easy PC forum June 15, 2025
  • Failure of polypropylene motor-run capacitors June 15, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz 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