Discussion in "Project Addition or Changes" started by    bgk3678    Nov 4, 2018.
Sun Nov 04 2018, 02:48 PM
#1
#include<reg51.h>
unsigned int data_out,command=0x80,temp,r;
sfr lcd_data_pin=0x90; //P1 port
sbit rs=P2^0; //Register select
sbit rw=P2^1; //Read/Write
sbit en=P2^2; //Enable pin
//unsigned char match;
unsigned char m,key,count,index=3,k,i1,x1;
unsigned char x[100];


void delay1(unsigned int itime )
{
unsigned int i,j;

for (i=0;i<itime;i++)
for (j=0;j<1275;j++);
}

void lcd_command(unsigned char comm) //Lcd command funtion
{
lcd_data_pin=comm;
en=1;
rs=0;
rw=0;
delay1(1);
en=0;
}

void lcd_data(unsigned char disp) //Lcd data function
{
lcd_data_pin=disp;
en=1;
rs=1;
rw=0;
delay1(1);
en=0;
}

lcd_string(unsigned char *disp) //Function to send string
{
int x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);
}
}
void lcd_ini() //Function to initialize the LCD
{
lcd_command(0x38);
delay1(5);
lcd_command(0x0F);
delay1(5);
lcd_command(0x80);
delay1(5);
}



void serialcom()
{
TMOD=0x20;
TH1=0xFD;
SCON =0x50;
TR1=1;
}


void serial(unsigned char x)
{
SBUF=x;
while(TI==0);
TI=0;
}
unsigned rx_data(void)
{
while(RI == 0); // WAIT UNTIL DATA IS RECEIVED
RI = 0; // CLEAR FLAG
return SBUF; // RETURN SERIAL DATA

}

void send2gsm(char *aaa)
{
unsigned int i;
for(i=0;aaa[i]!='\0';i++)
{
serial(aaa[i]);
}
}

void main()
{
//int l;
TMOD=0x20; //Enable Timer 1
TH1=0XFD;
SCON=0x50;
TR1=1; // Triggering Timer 1
lcd_ini();
delay1(200);

lcd_command(0x81); //Place cursor to second position of first line
//lcd_string("gsm3 interface: ");
delay1(200);
lcd_command(0x80);
lcd_string(" bgk GSM ");
lcd_command(0xc1);
serialcom();
send2gsm("AT");
serial(0x0D);
serial(0x0A);

delay1(2);
send2gsm("AT+CMGF=1");
serial(0x0D);
serial(0x0A);

delay1(2);








while(1)
{
send2gsm("AT+CMGR=1");
serial(0x0D);
serial(0x0A);





while(rx_data() !='+' );


for(i1=0;i1<40;i1++)

{
x[i]=rx_data();
}
delay1(20);

for(i1=0;i1<40;i1++)
{
lcd_data(x[i]);


delay1(20);


}


}
}
Sun Nov 04 2018, 02:52 PM
#2
sir ,
as I have posted the code ,it is not displaying the message from second line actually message is in second line
Tue Nov 06 2018, 06:10 PM
#3
I got this output in Proteus.



What are you expecting to happen ?


[ Edited Thu Nov 08 2018, 04:50 AM ]
Sun Nov 11 2018, 07:25 AM
#4
sir,Thank you for your response .The bgk GSM is the starting message will display on LCD, after that message sent by mobile will be displayed on LCD.
Sun Nov 11 2018, 04:03 PM
#5
I was just passing through looking for something else and noticed your post.

I'm not familiar with the GSM300 but a couple of things stand out from the code in the first post.

1) Some LCD displays have a small setup time from RS and RW to the leading edge of EN so it would be safer to put "en=1" after setting "rs" and "rw" in lcd_command() and lcd_data().
eg:
rs=0;
rw=0;
en=1;

2) In main() the code uses "i1" as the variable in the for loops but "i" as the variable for indexing the array x[].
This could just be a typing mistake in the first post or possibly the source of the problem.



[ Edited Sun Nov 11 2018, 04:03 PM ]
Mon Nov 12 2018, 01:21 AM
#6


2) In main() the code uses "i1" as the variable in the for loops but "i" as the variable for indexing the array x[].
This could just be a typing mistake in the first post or possibly the source of the problem.

wimac


Thanks for the comments.
Actually the missing "1" is due to the way the website handles text.
For some reason it deletes that "1".


[ Edited Tue Nov 20 2018, 05:39 AM ]
Mon Nov 19 2018, 01:11 AM
#7
I used your code in a Proteus simulation that can simulate a very simple modem.
Here is the result.
The Terminal box on the left is output from the 8051.
At the bottom is the modem's reply.

As you can see, you should get some text on line 2.
Because of the way the LCD displays text, more text would appear on line 4 of a 4 line display.
You have to display the text in chunks ,16 chars for 16 char wide displays, 20 for 20.
Move the cursor to a new line for each chunk.




[ Edited Tue Nov 20 2018, 05:39 AM ]

Get Social

Information

Powered by e107 Forum System

Conversation

Wed Apr 24 2019, 12:30 AM
Kenneth Evans
Kind Regards,
ExperimenterUK
Sun Apr 14 2019, 10:52 PM
@hassan malik post your problem in the "General help Guidance and Discussion" forum
Sun Apr 14 2019, 05:06 PM
RAJESH MAPARi
please send me code to interface atmega32 with 24c1024 serial eeprom
Sun Apr 14 2019, 01:33 PM
hassan malik
hello sir i installed proteus 7.8 professional on window 7 ultimate and window 10 but there would be same errors onn both windows. the error is bad license key.please any one help me
Sun Apr 14 2019, 01:32 PM
hassan malik
hello sir i installed proteus 7.8 professional on window 7 ultimate and window 10 but there would be same errors onn both windows. the error is bad license key.
ExperimenterUK
Sat Apr 06 2019, 05:59 PM
@deshrar. Please post your question in 8051 forum
Sat Apr 06 2019, 07:43 AM
deshraj
hallo mam.. i have downloded gsm notice board code its running fine on lcd but how so send msg to the module . i mean format of password and msg.. thank you
kevinharsha
Wed Apr 03 2019, 04:38 PM
Can i see the circuit diagram for the music tone library 8051 project?
ExperimenterUK
Wed Apr 03 2019, 02:45 AM
@Prudhvi. Please post your request in 8051 forum
Tue Apr 02 2019, 01:02 AM
Prudhvi reddy
Can you please help me writing code for gsm to send a particular SMS after pressing a key in 4×4 keypad ..in 8051

Downloads

Comments

obibikwe
Fri Apr 19 2019, 05:55 PM
gigyani
Thu Apr 18 2019, 01:43 AM
Deekshaaan
Wed Apr 17 2019, 03:02 PM
popli
Mon Apr 08 2019, 02:31 AM
kevinharsha
Wed Apr 03 2019, 04:33 PM
WWSIERT
Wed Apr 03 2019, 01:02 PM
Ausonagara
Mon Apr 01 2019, 10:42 AM
tutu10
Tue Mar 12 2019, 07:11 AM

Online

Guests: 43, Members: 0 ...

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

Members: 38059
Newest member: obibikwe
Forum Activity
gigyani Avatar
Posted By gigyani
Thu Apr 25 2019, 01:17 AM
when i add cufirst.hex its not working.after 2-3 s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Apr 24 2019, 12:29 AM
http://www.8051projects.net/download-d205-electron...
gigyani Avatar
Posted By gigyani
Tue Apr 23 2019, 09:22 PM
How to enter the electronic voting machine into vo...
Ansh12 Avatar
Posted By Ansh12
Mon Apr 22 2019, 09:12 AM
Then flash the led when you get any input on B0.Le...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Apr 19 2019, 05:35 PM
The full error is control_unit.asm(1294): error A4...
gigyani Avatar
Posted By gigyani
Thu Apr 18 2019, 10:09 PM
I'm using keil uvision5. attached is the rar file ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Apr 18 2019, 04:58 PM
Please zip your full code and post it.Which assemb...
gigyani Avatar
Posted By gigyani
Thu Apr 18 2019, 02:01 AM
STATREAD:MOV A, #WTCMD ;LOAD WRITE CO...
Deekshaaan Avatar
Posted By Deekshaaan
Wed Apr 17 2019, 04:26 PM
hello i downloaded the frequency counter project f...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Apr 16 2019, 12:23 AM
1) Can you explain what is the use of the p-n-p tr...