Microcontroller › 8051 › Gsm sim 300 interfacing with 8051
- This topic has 7 replies, 3 voices, and was last updated 11 years, 9 months ago by
Yadwinder Mehal.
-
AuthorPosts
-
April 18, 2013 at 1:24 am #2275
Yadwinder Mehal
ParticipantHello friends,
I want to interface sim300 with 8051 to make a project in which i want to display sms sent by a mobile no. On lcd screen. Please tell me about the interfacing and coding that i should follow to make my project working. Its very urgentApril 18, 2013 at 6:31 am #9510anil kumar
Participantthere is a command for reading sms so you read the sms from sim 300 anddisplay.
April 18, 2013 at 9:32 am #9511Yadwinder Mehal
ParticipantOk thanks anil. But will you please elaborate because m new to gsm kit. And i want to know that how to interface this kit with Micro-controller
8051.April 20, 2013 at 4:46 am #9535RUBEN KURIAKOSE
ParticipantHi;
You will get the code from engineers garage site that might help you for the project.
GSM interfacing.
// Program to interface GSM Module with 8051 microcontroller (AT89C51) using PC and LCD
#include<reg51.h>
#define port P1
#define dataport P2 // Data port for LCD
sbit rs = port^0;
sbit rw = port^1;
sbit en = port^2;
int count,i;
unsigned char check,str[15];
bit check_space ;
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 delay(unsigned int msec ) // Function for delay
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}
void lcd_cmd(unsigned char item) // Function to send command on LCD
{
dataport = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
}
void lcd_data(unsigned char item) // Function to display character on LCD
{
dataport = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
}
void lcd_data_string(unsigned char *str) // Function to display string on LCD
{
int i=0;
while(str!=' ')
{
lcd_data(str);
i++;
delay(10);
}
return;
}
void lcd()
{
lcd_cmd(0x38); // For using 8-bit 2 row LCD
delay(5);
lcd_cmd(0x0F); // For display on, cursor blinking
delay(5);
lcd_cmd(0x80); // Set the cursor on first position of lcd
delay(5);
}
void receive_data() interrupt 4 // Function to recieve data serialy from RS232 into microcontroller
{
str[++count]=SBUF; //Read SBUF
RI=0;
}
unsigned char byte_check() //Function to check carraige return and new line character
{
switch(str[0])
{
case 0x0a:
{ // Return 0x00 for new line
return 0x00;
break ;
}
case 0x0d:
{ // Return 0x01 for carriage return
return 0x1;
break ;
}
default:return 0x02 ; // Return 0x02 for characters except new line and carriage return
}
}
void main()
{
lcd(); // Initialize LCD
init_serial(); // Initialize serial port
count=(-1);
lcd_data_string("Ready");
delay(10);
lcd_cmd(0x01);
IE=0x94;
while(1)
{
if(count>=0)
{
check=byte_check(); //Check the character
if(check!=0x00)
{
if(check==0x01)
{
if(check_space==1) //Check previous character
{
lcd_data(0x20);
check_space=0;
}
}
else
{
lcd_data(str[0]);
check_space=1;
}
}
count--;
for(i=0;i<count;i++) // Shift the whole array to one left
{
str=str[i+1];
}
}
}
}
April 20, 2013 at 4:49 am #9536RUBEN KURIAKOSE
ParticipantThe LCD interfacing program is also available on engineers garage.
eg :
//Program to test LCD. Display single character "A"
#include<reg51.h>
#define cmdport P3
#define dataport P2
#define q 100
sbit rs = cmdport^0; //register select pin
sbit rw = cmdport^1; // read write pin
sbit e = cmdport^6; //enable pin
void delay(unsigned int msec) // Function to provide time delay in msec.
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcdcmd(unsigned char item) //Function to send command to LCD
{
dataport = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
}
void lcddata(unsigned char item) //Function to send data to LCD
{
dataport = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
}
void main()
{
lcdcmd(0x38); // for using 8-bit 2 row mode of LCD
delay(100);
lcdcmd(0x0E); // turn display ON for cursor blinking
delay(100);
lcdcmd(0x01); //clear screen
delay(100);
lcdcmd(0x06); //display ON
delay(100);
lcdcmd(0x86); // bring cursor to position 6 of line 1
delay(100);
lcddata('A');
}
April 23, 2013 at 5:46 am #9572Yadwinder Mehal
ParticipantActually sir i want to make electronics notice board by using 8051, sim 300 gsm module and 16×2 lcd display. I connected gsm with serial pins of 8051 by db9 port through max232 and lcd is connected to port0 of microcontroller, where as RS of lcd is connected to 2.5pin, RW to 2.7 and EN to 2.6
My friend its very urgent i have to submit my project within this week everything is ready except program and dats why nothing is going good please help me.
April 23, 2013 at 9:28 am #9576RUBEN KURIAKOSE
ParticipantCheck it one by one. First check the LCD-microcontroller interfacing. Before that you can check the working of microcontroller and your programmer by a sample LED blinking program. Then interface GSM modem to mc and if all works properly burn the full program to IC and check output.
April 26, 2013 at 11:51 pm #9588Yadwinder Mehal
ParticipantYes that is the thing i an asking. Asking for gsm program. I dnt have program for gsm. Please give me gsm coding my lcd is working properly and i had test it but dnt have gsm program
-
AuthorPosts
- You must be logged in to reply to this topic.