Microcontroller › 8051 › To interface GSM SIM900 with 8051 › i am doing project on gsm
July 28, 2012 at 6:15 am
#8346
Participant
i am doing project on gsm modem to send sms.i ve connected sim 900 modem through 8051 with max232.i ve the code as follows…………………………which was there in this website only,i ve just editted and added.i ve given the o/p to lcd.i am not getting a correct response……………please help me out……….
#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[50];
bit check_space;
void init_serial() // Initialize serial port
{
TMOD=0x20; // Mode2
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!=’