Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with sending messge by GSM modem using 8051mc

Status
Not open for further replies.

bpramod

Member level 1
Joined
Sep 21, 2011
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,534
Hi friends
i programmed 8051 using keil to send message by SIM300,,the connection between the sim300 and 8051 is correct..also the microcontroller and sim300 are working correctly individually but when i connect both and Reset but message is not sending...so what is the problem?,,,& my c code is as follow...plz help me



Code:
#include<reg51.h> // include at89x51 . h
#include<stdio.h>// include stdio . h
#include<stdlib.h>// include stdlib . h

unsigned char Command_AT[]=" AT\r";


unsigned char Command_echo[]="ATe0\r";	//echo off//

unsigned char Command_save[]="AT&W\r";  //save settings//

unsigned char Command_CMGF[]="AT+CMGF=1\r";
// AT+CMGF for selecting Text Mode

                  
unsigned char Command_CMGS[]="AT+CMGS =\"+919538847904\"\r";
// recepient mobile number


unsigned char msg02[]="Hello!";


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

void delay2(void)
{
	unsigned int i;
	for(i=0;i<65000;i++);
}

void gsmcmdsend(unsigned char *cmd)
{ 
	
	while(*cmd!='\0')
	{
	 SBUF=*cmd;
	 while(TI==0);
	 TI=0;
 	 cmd++;
	} 
	 
}


void gsminit(void)
{ // AT COMMANDS
	delay2();
	delay2();
	delay2();
	delay2();
	delay2();
	delay2();
	delay2();
	gsmcmdsend(Command_AT);
	delay2();
	gsmcmdsend(Command_echo);
	delay2();
	gsmcmdsend(Command_save);
	delay2();
	gsmcmdsend(Command_CMGF);
	delay2();
	gsmcmdsend(Command_CMGS);
	delay2();
    gsmcmdsend(msg02);
	delay2();
	SBUF = 0x1A;
	while(TI==0); TI = 0;
	 

}



void main (void)
{
	initialize_serialcommunication();
    gsminit();
    while (1);
}


plz help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!:sad::-(
 
Last edited by a moderator:

First point - you tested this code that 8051 giving serial port output using hyper ternianl or some thing like that....I think Seiral Port interrupt ES should be made activited
 

First point - you tested this code that 8051 giving serial port output using hyper ternianl or some thing like that....I think Seiral Port interrupt ES should be made activited
i am not getting..but i used demo serial communication program to check my microcontroller ,,ya its sending chracters to hyperterminal correctly...but why not to GSM modem?...
 

i am not getting..but i used demo serial communication program to check my microcontroller ,,ya its sending chracters to hyperterminal correctly...but why not to GSM modem?...

Do you mean say that you are getting same string output on the hyper terminal from the hardware that you want to communicate to GSM or from some another demo board
 

Do you mean say that you are getting same string output on the hyper terminal from the hardware that you want to communicate to GSM or from some another demo board
ya i am getting same string output when i connect it to hyperterminal means my program is correct,,i'e serial communication is successfull with hyperterminal but when i connect it to the GSM replacing Hyperterminal then why it is not sending message? this is my problem..also gsm board is working correctly...
 

hi bpramod,

1. fix the baud rate of SIM300 i.e. no autobaudrate.

2. include newline character (\n) in your AT command string.
example:

unsigned char Command_CMGF[]="AT+CMGF=1\r\n";

3. i guess you have different board for SIM300 and 8051. first power up the GSM board for some time (say 1 minute), before running microcontroller. SMS AT commands will not work until GSM module is successfully registered to the GSM network.

4. your program is not processing output from GSM module, and you are sure that 8051 and SIM300 is working. Therefore to monitor whats going on, connect SIM300 Tx line to hyperterminal. This way you can see the AT results form GSM module.

5. lastly check your electrical connection again i.e. SIM300 RTS line, pullups etc

goodluck
 

hi...i addede "\n" at the end of each command..also i added more delays in program to wait for the response of GSM...still it is not working..no problem of GSM and mc..also i connected mc and gsm with rs232 to rs232 DB9 connectors...still it is not working:oops::oops::oops::oops:plz help me
 

please specify whether you are using SIM300 module (module only) or SIM300 based GSM modem (complete with cabinet).
in latter case disable modem flow control before connecting to the microcontroller.

tap Tx line of GSM module and connect to pc, see the response in terminal program. you can take appropriate action only if you know whats going on in there.
 

please specify whether you are using SIM300 module (module only) or SIM300 based GSM modem (complete with cabinet).
in latter case disable modem flow control before connecting to the microcontroller.

tap Tx line of GSM module and connect to pc, see the response in terminal program. you can take appropriate action only if you know whats going on in there.
another thing is i connected only three pins (2,3,5) of D9 connectors for serial communication between GSM and 8051...is it ok?....where i used two rs232 D9 connectors..
 

Check Pin 2 of modem is connected to Pin 3 of DB9 conn of 8051 board and Pin 3of modem to Pin 2 of 8051 board i.e Cross connection.
Make sure their is common grounding for both boards.

Can you send ur schematics or ur snaps of setup.
 

another thing is i connected only three pins (2,3,5) of D9 connectors for serial communication between GSM and 8051...

also make sure that you short pin 7(RTS) and pin 8(CTS) on GSM side.

use cross cable as suggested by kirangowle, and i think at this point you really need to post current schematic or snap.
 
Last edited:

Dear al,
Even i am also facing the same problem..

Sending AT commands from Hyperterminal its working fine... but when i send the AT commands from PIC micro.. its not working..

Please send me the C code, how to code & send the SMS? to my email id: smilly_siva@yahoo.com at earliest..

my mobile: 9940328709.. please call me.. its very urgent.

Thanks,
Sivaprakash.R
 

same problem i got in Gsm Modem please send me code of gsm
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top