Hai Sir,
Iam doing my final year project on the topic "GSM based Wireless notice board".Iam very weak in coding.So i require the complete working code for the project.My circuit diagram is as shown below and my gsm modem is SIM900A.I have got a program code which shows an error "DATA SEGMENT EXCEED " in keil uvision3.Iam using uart connection from the modem.I have no idea about attaching an EEPROM to the 8051 uC.So i need a program to display the characters which is send from mobile directly to an 16x2 LCD display without storing it.Iam using the uC AT89s52.
Will there be any problems of using SIM900A GSM module in this project. I have already purchased the product,and i don't have any other choice...So please help.........its urgent......
I only understand c-programming and don't know Assembly language....
MY C-CODE is :
#include <REGX51.H>
sbit rs=P1^0;
sbit rw=P1^1;
sbit en=P1^2;
void lcd_command(unsigned char);
void lcd_data(unsigned char);
void string(unsigned char *disp);
void delay(unsigned int);
void read(char*);
void newline();
void display (char);
void send();
void serial();
void nextline(unsigned char);
void nextline1(unsigned char);
void nextline2(unsigned char);
sfr chdata=0xA0;
void lcdnewline();
char a[161];
char b[13];
int i,j,z,k,l,f=0;
void main()
{
P0=0x00;
P1=0x00;
P2=0xFF;
delay(100);
lcd_command(0x38);
delay(100);
lcd_command(0x80);
delay(100);
lcd_command(0xc0);
delay(100);
lcd_command(0x0e);
delay(100);
lcdnewline();
serial();
read("AT");
newline();
read("AT+CMGF=1");
newline();
lcdnewline();
read("AT+CMGD=1");
newline();
lcdnewline();
while(1)
{
lcd_command(0x83);
string("NOTICE BOARD");
for(i=0;i<=13;i++)
{
while(RI==0);
b
=SBUF;
RI=0;
}
lcdnewline();
string("Command Signal");
if((b[2]=='+')||(b[3])=='+')
{
if((b[3]=='C')||(b[4])=='C')
{
if((b[4]=='M')||(b[5]=='M'))
{
if((b[5]=='T')||(b[6])=='T')
{
if((b[6]=='I')||(b[7])=='I')
{
lcd_command(0xC4);
string("received");
lcdnewline();
//delay(300);
read("AT+CMGF=1");
newline();
read("AT+CMGR=1");
newline();
newline();
//newline();
//newline();
for(l=0;l<=161;l++)
{
while(RI==0);
a[l]=SBUF;
RI=0;
}
for(l=60;l<=161;l++)
{
f=1;
if(a[l]=='a')
{
k=0;
do
{
k++;
l++;
if(k<=20)
{
lcd_data(a[l]);
}
if((k>20) && (k<=40))
{
nextline(f);
lcd_data(a[l]);
f++;
}
if((k>40) && (k<=60))
{
nextline1(f);
lcd_data(a[l]);
f++;
}
if((k>60) && (k<=80))
{
nextline2(f);
lcd_data(a[l]);
f++;
}
} while(a[l]!='$');
l=162;
break;
}
//break;
}
delay(65000);
}
}
}
}
}
} /* while end here*/
} /* MAIN ends here*/
/* PROTOTYPE FUNCTIONS */
void lcd_command(unsigned char value)
{
chdata=value;
rs=0;
rw=0;
en=1;
delay(100);
en=0;
}
void lcd_data(unsigned char value)
{
chdata=value;
rs=1;
rw=0;
en=1;
delay(150);
en=0;
}
void read(char *ch)
{
int i;
for(i=0;ch!='\0';i++)
{
display(ch);
}
}
void display(char c)
{
SBUF=c;
send();
}
void send()
{
while(TI==0);
TI=0;
}
void newline()
{
SBUF='\r';
while(TI==0);
TI=0;
SBUF='\n';
while(TI==0);
TI=0;
}
void delay(unsigned int num)
{
unsigned int k,q;
for(k=0;k<num;k++)
{
for(q=0;q<num;q++);
}
}
void lcdnewline()
{
lcd_command(0x01);
delay(100);
lcd_command(0x02);
delay(100);
}
void serial()
{
SCON=0x50;
TMOD=0x20;
TH1=0xFD;
TR1=1;
}
void string(unsigned char *disp)
{
int x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);
}
}
void nextline(unsigned char v)
{
if(v==1)
{
lcd_command(0XC0);
}
}
void nextline1(unsigned char v)
{
if(v==21)
{
lcd_command(0X94);
}
}
void nextline2(unsigned char v)
{
if(v==41)
{
lcd_command(0XD4);
}
}