Discussion in "Embedded GSM Development" started by    Alvanbert    Feb 10, 2012.
Thu Mar 01 2012, 06:28 PM
#31
yeah it receives them and can display them if i widen the loop to display ten messages.
Fri Mar 02 2012, 04:13 AM
#32
Ok then its fine..
U can divide the msg in next line.Use 20X4 LCD so that entire msg will be displayed in one shot.
Fri Mar 02 2012, 12:23 PM
#33
Hi kiran. I have tried using the 20x4 lcd display but the problem with it is it skips the second and fourth line hence it still leaves out some text


[ Edited Fri Mar 02 2012, 12:54 PM ]
Fri Mar 02 2012, 12:26 PM
#34
if msg has >40 characters. As with the 40x2, it displays only on the first line and leaves out some text as well


[ Edited Fri Mar 02 2012, 12:55 PM ]
Fri Mar 02 2012, 12:30 PM
#35
I want the 20x4 or 40x2 display to display on all line the same message(at once) from top to bottom without leaving out some text. Thanx


[ Edited Fri Mar 02 2012, 12:56 PM ]
Fri Mar 02 2012, 12:33 PM
#36
And I had forgotten to ask, Is it possible to add a scrolling format to the message display where by ot scrolls from the last line upwards as other messages follow from below.


[ Edited Fri Mar 02 2012, 12:59 PM ]
Fri Mar 02 2012, 02:02 PM
#37
Yes u can scroll the msgs.
Can u show us the code how u are breaking the entire array and sending to LCD.
Fri Mar 02 2012, 04:07 PM
#38
attached below is my entire code.

		 #include <REGX52.H>


#define LCD P1
#define LCD_EN		0x80
#define LCD_RS		0x20
                     
//LCD Commands        

#define LCD_SETMODE		   0x04
#define LCD_SETVISIBLE	   0x08
#define LCD_SETFUNCTION	   0x28
#define LCD_SETDDADDR	   0x80

void delayms(unsigned char);
void delayus(unsigned char);
void lcd_init();
void lcd_reset();
void lcd_cmd (char);
void lcd_data(unsigned char);
void lcd_str (unsigned char *);
void clear(void);
void tx0(unsigned char);
void delay_sms (unsigned int);
void SMSString(char*text) ;
void init();
void read_text(unsigned char *);
unsigned int var,i,n;
unsigned char j,abc;
unsigned char idata msg1[150];
unsigned char rec_no[20];
unsigned char time_date[20];
void gsm_loop(unsigned int);

void serial () interrupt 4
{
msg1[abc]=SBUF;
abc++;
RI=0;
}

void main (void)
{

n=0x35;

gsm_loop(n);
delay_sms(2000);
}

void gsm_loop(unsigned int n)
{
  for(i=0x31;i<=n;i++)
  {
  clear();
  init();
  lcd_init();
  var=i;
  SMSString("AT\r"); // AT commands to initialize gsm modem
  delay_sms(1000);

  SMSString( "ATe0\r"); // turn off echo
  delay_sms(1000);

  SMSString( "AT&W\r"); // save settings
  delay_sms(1000);

  SMSString( "AT+CMGF=1\r"); // select text mode for sms
  delay_sms(1000);

  SMSString( "AT+CNMI=2,1,0,0,0\r"); // notification of new sms
  delay_sms(1000);

  SMSString( "AT+CMGR=");   // AT command to read sms
  tx0(var);
  SMSString("\r");

  IE=0X90;   // Enable serial interrupt
  delay_sms(2000);

  read_text(msg1);		// read sms and store in buffer msg1

  delay_sms(2000);			  
  IE=0X00;       // Disable all interrupt
            
  }
}


void init(void)
{
j=0;
abc=0;
TL1=0XFD; //9600 @ 11.0592
TH1=0xFD;
TMOD=0x20;
SCON=0x50;
TR1=1;
}

void SMSString(unsigned char* text) //function to send SMS using GSM modem
{
while (*text)
{
tx0(*text++);
}
}


void tx0(unsigned char x) //send data to serial port 0
{
EA=0;
SBUF=x;
while(TI==0);
TI=0;
EA=1;
}


void delay_sms (unsigned int count)
{
unsigned int i;                         // Keil v7.5a 
    while(count) {
        i = 115;
                while(i>
0) i--;
        count--;
}
}

void read_text( unsigned char *msg)
{
unsigned char *temp;
temp=msg;
do
msg++;
while(*msg!='#');
msg++;
do
*temp++=*msg++;
while(*msg!='#');       // reaching at end of message
*temp='\0';


lcd_cmd(0x80);
lcd_str(msg1);



         // array having message

}

void lcd_reset()
{
	LCD = 0xFF;
	delay_sms(40);
	LCD = 0x03+LCD_EN;
	LCD = 0x03;
	delay_sms(40);
	LCD = 0x03+LCD_EN;
	LCD = 0x03;
	delay_sms(5);
	LCD = 0x03+LCD_EN;
	LCD = 0x03;
	delay_sms(5);
	LCD = 0x02+LCD_EN;
	LCD = 0x02;
	delay_sms(5);
}


void lcd_init ()
{
	lcd_reset();
	lcd_cmd(LCD_SETFUNCTION);                    // 4-bit mode - 1 line - 5x7 font. 
	lcd_cmd(LCD_SETVISIBLE+0x04);                // Display no cursor - no blink.
	lcd_cmd(LCD_SETMODE+0x02);                   // Automatic Increment - No Display shift.
	lcd_cmd(LCD_SETDDADDR);                      // Address DDRAM with 0 offset 80h.
 }

 void lcd_cmd (char cmd)
{ 
	LCD = ((cmd >
>
 4) & 0x0F)|LCD_EN;
	LCD = ((cmd >
>
 4) & 0x0F);

	LCD = (cmd & 0x0F)|LCD_EN;
	LCD = (cmd & 0x0F);

    delay_sms(1);
}

void lcd_data (unsigned char dat)
{ 
	LCD = (((dat >
>
 4) & 0x0F)|LCD_EN|LCD_RS);
	LCD = (((dat >
>
 4) & 0x0F)|LCD_RS);
	
	LCD = ((dat & 0x0F)|LCD_EN|LCD_RS);
	LCD = ((dat & 0x0F)|LCD_RS);

    delay_sms(1);
}

void clear(void)
{
unsigned char a;
for(a=0;a<100;a++)
msg1[a]=0x00;
}

void lcd_str (unsigned char *str)
{
	while(*str){
		lcd_data(*str++);
	}
}

Fri Mar 02 2012, 04:09 PM
#39
The above code only displays messages enclosed between #. i wanted to include that option in my code
Fri Mar 09 2012, 04:26 PM
#40
Guys. Pliz really need your help

Get Social

Information

Powered by e107 Forum System

Conversation

Sun Apr 30 2017, 05:49 AM
Lijin G Varghese
Can u send me the circuit diagram for Program to interface GSM Module with 8051 microcontroller (AT89C51) using PC and LCD
Sun Apr 30 2017, 05:48 AM
Lijin G Varghese
Program to interface GSM Module with 8051 microcontroller (AT89C51) using PC and LCD
Fri Apr 28 2017, 03:47 PM
SANDEEP T S
I need pcb wizard 3.5 version kindly send valid link of yours
Fri Apr 28 2017, 03:46 PM
SANDEEP T S
I need pcb wizard 3.5 version
ExperimenterUK
Mon Apr 17 2017, 11:56 PM
Sorry..We had a problem with registration.Confirmation emails were not sent.Please re-register
Thu Apr 13 2017, 07:29 PM
Piyush Aughad
I want circuit & program for radar detection using Microcontroller 8051
Tue Apr 11 2017, 03:27 AM
Shabbir Ahmed
Hi Ajay ....hope you and your family all will be fine are you working on andriod aplications if yes then plz reply me
Sun Apr 09 2017, 06:33 PM
ATHULYA NAIR
Dear Sir, I need to know what are the complexity for programming in 8051 Microcontroller for three phase inverter?
Sun Apr 09 2017, 06:32 PM
ATHULYA NAIR
Dear Sir,
Sun Apr 09 2017, 04:43 AM
Rohit chandra joshi
Sir I need ur help urgently.i am trying to make pc controlled led scrolling display using 8051.when i am trying to generate hex file of the code that is given by pratik suthar.it gives the error Target not created Limit:0800h I am using keil uvision4 software. Even i have tried to burn the given hex file that is atteched with the code but my led are not glowing. Pls help me sir .i struck in this problem from last month and till now i am not able to short out the problem. Pls suggest me to solve the problem.mail me at [email protected] Thanks

Downloads

Comments

anshulece
Fri Apr 28 2017, 03:43 PM
Masoooud
Tue Apr 25 2017, 06:57 PM
BOuissal
Mon Apr 24 2017, 02:46 PM
tranhunga
Mon Apr 24 2017, 01:11 AM
Suslik
Sun Apr 23 2017, 09:26 AM
soumk
Sun Apr 23 2017, 06:22 AM
Vavachi1996
Tue Apr 18 2017, 08:01 PM
yasmine
Tue Apr 18 2017, 03:10 PM

Online

Guests: 65, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37814
Newest member: anshulece
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon May 01 2017, 12:42 AM
Sorry, that doesn't sound "normal".I think a re-in...
Deepakvaishu Avatar
Posted By Deepakvaishu
Fri Apr 28 2017, 11:18 AM
Yes proteus is loaded ,with all projects.....Once ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Apr 28 2017, 05:06 AM
Does Proteus load at all ?Does it only crash on c...
Deepakvaishu Avatar
Posted By Deepakvaishu
Wed Apr 26 2017, 06:59 AM
hello...I am getting an error when I am trying to ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Apr 18 2017, 10:52 PM
Thanks for the comment.Glad you got it working.
Deepakvaishu Avatar
Posted By Deepakvaishu
Tue Apr 18 2017, 06:19 AM
Thank you very much...Today I got the output for a...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Apr 06 2017, 05:38 PM
Is it initially assigned as '0', and then when the...
Deepakvaishu Avatar
Posted By Deepakvaishu
Thu Apr 06 2017, 07:55 AM
hello,Thanks for the attachment.I have gone throug...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Mar 25 2017, 09:49 PM
I have attached code showing one method you could ...
Deepakvaishu Avatar
Posted By Deepakvaishu
Sat Mar 25 2017, 07:59 AM
I am using Keil and 8051 microcontroller