Вы находитесь на странице: 1из 4

2/28/2014

Interface GSM with 8051 Microcontroller (AT89C51)

Follow
Follow

Home

Insight

Knowledge Base

EG Labs
Contribute

Articles
Advertise

Invention Stories
Subscribe

Forum
Contact Us

Arduino Projects | Raspberry Pi | Electronic Circuits | AVR | PIC | 8051


Electronic Projects | How To

AMIT DAS
Invite a friend
My account
Create content

Interfacing GSM Module with 8051


microcontroller (AT89C51) without
using PC

Add a Project
Log out
INSIGHTDISCOVER
HOW GADGETS
WORK?

Adapter
Banana Jack
Electric Beard
Trimmer
HDMI Cable
Membrane
Keypad
Micro Switch
Scientific
Calculator
SMPS
Telephone
Turbidity
Sensor
USB
Connector
...more

EG
SPONSORED
VIDEO
ST Micro ARM
Cortex M4
Evaluation
Board

MC076
Summary

Description

Circuit Diagram

Code

Components

// Program to Interface GSM Module with 8051 microcontroller (AT89C51) without usin
#include<reg51.h>
#define port P1
#define dataport P2
sbit rs = port^2;
sbit rw = port^3;
sbit en = port^4;
int count,i;
unsigned char check,str[15];
bit check_space;
void init_serial()
{
TMOD=0x20;
TH1=0xfd;
SCON=0x50;
TR1=1;
}
void delay(unsigned int msec)
{
int i,j;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}

// Data port for LCD

// Initialize serial port

// Mode2
// 9600 baud
// Serial mode=1 ,8-Bit data,1 Stop bit ,1
// Start timer
// Function for delay

void lcd_cmd(unsigned char item)


{

http://www.engineersgarage.com/microcontroller/8051projects/interfacing-gsm-8051-microcontroller-circuit-code

// Function to send command on LCD

1/4

2/28/2014

Interface GSM with 8051 Microcontroller (AT89C51)

Access Denied

dataport = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;

Altera Cyclone
V GX FPGA
Board

void lcd_data(unsigned char item)


{
dataport = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
}

// Function to display character on

void lcd_data_string(unsigned char *str)


Access Denied

// Function to display string on LC

int i=0;
while(str[i]!='\0')
{
lcd_data(str[i]);
i++;
delay(10);
}
return;

Intel NUC Core


i5 4250U
Processor

Access

IR4312M
Power Module

}
void lcd()
{
lcd_cmd(0x38);
delay(5);
Denied
lcd_cmd(0x0F);
delay(5);
lcd_cmd(0x80);
delay(5);
}
void transmit_data(unsigned char str)
{
SBUF=str;
while(TI==0);
TI=0;
}

void receive_data()
Access Denied

interrupt 4

// For using 8-bit

// For display on c

// Set the cursor o

// Function to transmit data through serial


//Store data in SBUF
//Wait till data transmits

// Function to recieve data serialy from RS

{
http://www.engineersgarage.com/microcontroller/8051projects/interfacing-gsm-8051-microcontroller-circuit-code

2/4

2/28/2014

Interface GSM with 8051 Microcontroller (AT89C51)

FEATURED
ARDUINO
PROJECTS
Getting Started
with Arduino
LCD Arduino
Interfacing
Xbee Arduino
Interfacing
Interface GPS
with Arduino
Interface SD
Card with
Arduino
Call using
Keyboard, GSM
& Arduino
SPI Module of
Arduino
... more arduino
projects

FEATURED
RASPBERRY PI
PROJECTS
How to Load
Ubuntu on
Raspberry Pi
How to
Configure
Raspberry Pi
How to use
Alarm Signal in
Raspberry Pi
How to Get GUI
on Raspberry Pi
Playing Snake
Game using
Raspberry Pi

RI=0;
str[++count]=SBUF;

//Read SBUF

unsigned char byte_check()


// Function to check carraige return and ne
{
switch(str[0])
{
case 0x0a:
{
// Return 0x00 for new line
return 0x00;
break ;
}
case 0x0d:
{
// Return 0x01 for carriage return
return 0x01;
break ;
}
default :return 0x02 ;
// Return 0x02 for characters excep
}
}
void main()
{
lcd();
init_serial();
count=(-1);
delay(500);
lcd_data_string("Ready");
delay(10);
lcd_cmd(0x01);
IE=0x94;
transmit_data('A');
delay(1);
transmit_data('T');
delay(1);
transmit_data(0x0d);
delay(50);
while(1)
{
if(count>=0)
{
check=byte_check();
if(check!=0x00)
{
if(check==0x01)
{
if(check_space==1)
{

http://www.engineersgarage.com/microcontroller/8051projects/interfacing-gsm-8051-microcontroller-circuit-code

// Initiali
// Initiali

// Transmit 'A' to

// Transmit 'T' to

// Transmit carriag

// Check th

// Check pr

3/4

2/28/2014

Interface GSM with 8051 Microcontroller (AT89C51)

lcd_data(0x20);
check_space=0;

Game Pad
How to Use
Raspberry Pi as a
Game Server

}
}
else
{

... more raspberry


pi projects

lcd_data(str[0]);
check_space=1;
}
}
count--;
for(i=0;i<count;i++)
{
str[i]=str[i+1];
}

// Shift the whole

}
}
}

Tweet

64852 reads

Circuit Board Assembly


thuse.net/Enquire_Now
Printed Circuit Boards Assembly Product At Reasonable Price In Pune

YOU ARE HERE Home

Top

Copyright 2012 EngineersGarage. All rights reserved. Privacy Policy | Refund Policy | About Us

http://www.engineersgarage.com/microcontroller/8051projects/interfacing-gsm-8051-microcontroller-circuit-code

4/4

Вам также может понравиться