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 Communication using 8051

GSM Communication using 8051

|

Microcontroller › 8051 › GSM Communication using 8051

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 3 months ago by RUBEN KURIAKOSE.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • April 13, 2013 at 2:33 pm #2268
    malik
    Participant

    Hi All,

     

    I am a newbie to GSM SIM900 and in learning stage, I am doing a project to transmit and recieve data/instructions to 8051 through GSM. Initially I have written a code that will send a text string to a certain mobile number if 8051 detects 1 on its Port 0. Below is the code which to some extant I have written and copied. Please guide me whether this code is good or not? Based on this code I have further action which I need to perform and will mention here later. Please I need kind check on this code, Thanks!

     

    —-CODE—-

     

     

    #include<reg51.h>
    unsigned char str;
     
    void init_serial()  // Initialize serial port
    {
    TMOD=0x20;        // Mode=2
    TH1=0xfd;  // 9600 baud
    SCON=0x50;        // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit  , Receiving on
    TR1=1;          // Start timer
    }
     
    void transmit_data(unsigned char str) // Function to transmit data through serial port
    {
    SBUF=str;                // Store data in sbuf
    while(TI==0);                        // Wait till data transmit
    TI=0;
    }
     
    void receive_data()  interrupt 4 // Function to recieve data serialy from RS232 into microcontroller
     {
    str=SBUF;                       // Read sbuf
    RI=0;
    transmit_data(str);             // Transmit to HyperTerminal
     }
     
    void main()
    {
    init_serial(); // Initialize serial port
    IE=0x90; 
     
    int N1;
    P0=0xFF;
    delay(50);
    N1=P0;
     
    if (N1==1)
    {
    str=(“AT+CMGF=1r”); //Text Mode
    transmit_data();
    delay(20);
    str=(“AT+CMGS=”9600292363″%c”,13);  //Type your desired number to with the text is to send
    transmit_data();
    delay(20);
    str=(“Hi :-) GSM Modem Test”);    //sending message
    transmit_data();
    delay(20);
    }
    April 20, 2013 at 4:41 am #9534
    RUBEN KURIAKOSE
    Participant

    Did you check it any compiler.(Kiel u-vision).

  • 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

  • Fun with AI and swordfish basic July 19, 2025
  • using a RTC in SF basic July 19, 2025
  • Does US electric code allow branching ? July 19, 2025
  • Faulty heat air gun (dc motor) - problem to locate fault due to Intermittent fault July 19, 2025
  • Sump pit water alarm - Kicad 9 July 19, 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