Home - Search - Members
Full Version: problem is sending sms with 8051 by siemens C55
cllunlu
Apr 22 2008, 8:10 PM
hi friends.
I am trying to send sms with 8051(89c51rc2)and siemens C55.But I failed.I dont know why.When I try to send sms,cellphone turns off.
My schematic and C code here.where is my mistake.I dont know.
Also I can send sms by hyperterminal with data cable.And I simulated it by proteus succesfully.And it is project to pass the class.Plz help me firends.

/////////////////////////////////////////////////////////////////////////

that is C code:

///////////////////////////////////////////////////////////////////////////

CODE:
#include <t89c51Rx2.h> //
unsigned char rcvd[2];
unsigned char j;
unsigned char k;
bit ok=0;
bit ok1=0;

void init() /// u put int() here
{
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;
}

void sendString(unsigned char *a)
{
while(*a!='\0')
{
SBUF=*a;
while(TI==0);
TI=0;
a++;
}
}
void sendChar(unsigned char b)
{
SBUF=b;
while(TI==0);
TI=0;
}
unsigned char rcv()
{
while(RI==0);
RI=0;
return SBUF;
}
void checkOK()
{
for(j=0;j<2;j++)
rcvd[j]=rcv();
if(rcvd[0]=='o'&&rcvd[1]=='k')
ok=1;
else
ok=0;
}
void checkOKe()
{
k=rcv();
if(k=='>')
ok1=1;
else
ok1=0;
}

void main()
{
P2_0=0;
P2_1=0;
while(1)
{
if(P1_0==0)
{
init();
sendString("AT");
sendChar(0x0D);
checkOK();
if(ok==1)
{
P2_0=1;
sendString("AT+CMGS=19");
sendChar(0x0D);
checkOKe();
if(ok1==1)
{
P2_1=1;
sendString("079109459208003311000C910945664173350000AA05E8329BFD06");
//sms center no:+905429800033, destination number:+905466143753, message:"HELLO"
sendChar(0x1A);
}
else P2_1=0;
}
else
P2_0=0;
}
}
}


enson.rar

shyam
Apr 22 2008, 8:25 PM
sendString("079109459208003311000C910945664173350000AA05E8329BFD06");
//sms center no:+905429800033, destination number:+905466143753, message:"HELLO"


what is this??
PDU??


doesnot the modem support text mesaging???
cllunlu
Apr 22 2008, 9:10 PM
yes it is pdu mode.Because my cellphone is siemens C55 and it supports only pdu mode.
I can send sms by hyperterminal with pdu mode.And I simulated it by proteus.Serial communication looks success.But it doesnt work when I do that schematic.Cellphone close itself.I dont know why?
Ajay
Apr 23 2008, 1:53 AM
problem seems here..
CODE:
void checkOK()
{
for(j=0;j<2;j++)
rcvd[j]=rcv();
if(rcvd[0]=='o'&&rcvd[1]=='k')
ok=1;
else
ok=0;
}


you are checking for small 'o' and small 'k' whereas phone sends capital 'O' and capital 'K'. so you variable ok is never 1. I hope you got my point.

So make the change in program as..
CODE:
if(rcvd[0]=='O'&&rcvd[1]=='K')
 
abbas1707
Apr 23 2008, 2:13 AM
also you dont need to send all those commands...just try to send at+cmgs.and dont check OK.
cllunlu
Apr 23 2008, 2:19 AM
I know.But I wanna check my pdu mode.So I have to know right communication.And my schematic is right?
abbas1707
Apr 23 2008, 2:27 AM
in schematic......try with DTR pin of mobile = high
cllunlu
Apr 23 2008, 2:39 AM
But I dont understand DTR pin of mobile=high

how it will be.It necessary.And how?
cllunlu
Apr 23 2008, 2:43 AM
this schematic is right too?

abbas1707
Apr 23 2008, 2:43 AM
do you know pin configuration of your mobile connector??you are not using datacable right?
cllunlu
Apr 23 2008, 2:54 AM
I am not using data cable.And ı know siemens c55 pin configuration.
cllunlu
Apr 23 2008, 3:01 AM
my cellphone is siemens c55
and pin configuration is:

http://pinouts.ru/CellularPhones-P-W/siemens_c55_pinout.shtml

where is DTR?
Ajay
Apr 23 2008, 3:41 AM
as you said u are connecting it to c55 directly then there is no need of DTR.. just direct connection with tx, rx and gnd.

Did you try what i said? did you make changes in program?
cllunlu
Apr 23 2008, 6:07 AM
ok.I changed my program.You said me change 'O' and 'K' replaca 'o' and 'k'.I did but I havent tried yet.I will try soon.Thnks for everything
GioppY
Apr 23 2008, 7:47 AM
You have to buffer, or add a pull up resistor to P3.1.
Also led design is wrong.
8051 family has open drain output stage with a weak pull up.
The cellphone rx pin never see a high level.
Regards
cllunlu
Apr 24 2008, 3:03 AM
hi gioppy.
I didnt understand you.
You said "add a pull up resistor to P3.1"
I have done already it.After that "led desing is wrong"how?

8051 family has open drain output stage with a weak pull up.
The cellphone rx pin never see a high level.

can you explain them more?
Ajay
Apr 24 2008, 8:17 AM
did you test what i said?
GioppY
Apr 24 2008, 8:19 AM
I do not see any pull up resistor in your schematic.
The 8051 port pin can sink 1.6mA (3.2mA for port 0) and source 60uA.

When used as outputs, all port pins will drive the state to which the associated SFR latch bit has been set.
When a 0 is written to a bit in port the pin is pulled low (0).
When a 1 is written to a bit in port the pin goes into a high impedance state.
Only the internal (weak or medium) pull the pin up.

http://www.freewebs.com/maheshwankhede/ports.html

Atmel at89c51rc2 doc4180.pdf
Pag.13 Port type
Pag.107 Electrical characteristics

Regards
cllunlu
Apr 24 2008, 7:28 PM
thnks gioppy.Can you make a right schematic for my project .Please...
sashijoseph
Apr 24 2008, 9:46 PM
In your schematic just add a 10k resistor between Vcc and P3.1......that's your pullup.
Like Gioppy suggested your LED's are sourcing current from the 8051 which is bad...they should be made to sink current into the 8051.Look at the attached ckt..

And have you tried out Ajay's suggestion?Please confirm..

cllunlu
May 7 2008, 6:52 PM
ajay I have tried your suggestion.But I am failed.Cell phone doesnt give me anything.Where is my mistake plsease help me
abbas1707
May 8 2008, 6:14 AM
problem can be in micro-mobile connection.can't say more about it
cllunlu
May 8 2008, 6:16 AM
my schematic and my codes are correct?
abbas1707
May 8 2008, 6:23 AM
try to send only 1 command..like atd , tell about response you get
sashijoseph
May 8 2008, 1:42 PM
Have you tried with the external pullup?
Ajay
May 8 2008, 5:05 PM
I gave you two suggestions which one you tried?
replacing ok with OK?

try abbas's suggestion too.. no need to wait for OK.. just try sending AT commands.
cllunlu
May 8 2008, 5:10 PM
ajay I havent anytime to do it.Have you any projects that is finished about it.please help me.I have many class too.I havent more times
please help me.
Ajay
May 8 2008, 5:34 PM
edit your main for a while and replace it with this
CODE:
void main()
{
        P2_0=0;
        P2_1=0;
        while(1) {
                if(P1_0==0) {
                        init();
                        sendString("AT");
                        sendChar(0x0D);
                        sendString("ATE0");
                        sendChar(0x0D);
                        P2_0=1;
                        sendString("AT+CMGS=19");
                        sendChar(0x0D);
                        P2_1=1;
                        sendString("079109459208003311000C910945664173350000AA05E8329BFD06");
                        //sms center no:+905429800033, destination number:+905466143753, message:"HELLO"
                        sendChar(0x1A);
                        sendChar(0x0D);
                }
        }
}
 


comment the function which you are not using...
like checkOK and all.. then try on controller again.

waiting for response.
cllunlu
May 8 2008, 5:42 PM
just I will change my main function?and but in main functiom havent delay when transmitting at commands

cllunlu
May 8 2008, 6:01 PM
I didnt understand external puul-up.I know just need when we use P0 port.we have to use external pull up.for P2 port doesnt need external pull up ,doesnt
it?
abbas1707
May 8 2008, 8:37 PM
you can put delay after this command
CODE:

     sendString("AT+CMGS=19");
     sendChar(0x0D);
     msdelay(200);
 
Ajay
May 9 2008, 2:46 PM
yeah put delay after each at command.
cllunlu
May 16 2008, 6:22 PM
ok thnks friends.I have sent sms by 8051.I did it.My mistake is connection from 8051 to GSM.
Thnks a lot....
Ajay
May 16 2008, 11:17 PM
good glad it worked...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Rickey's World © 2003 - 2007