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.

sending SMS from a GSM modem

Status
Not open for further replies.

Jestin Kuriakose

Newbie level 6
Newbie level 6
Joined
Dec 21, 2013
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
97
i am using atmel AT89S52 ,SIM300 gsm modem . i just want to send a sms from the GSM modem without using pc.here is my code-

Code:
#include<reg51.h>

void serialcomm()
{

 TMOD=0x20;        // Mode=2
 TH1=0xfd;         // 9600 baud
 SCON=0x50;        // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit  , Receiving on
 TR1=1;           // Start timer
  
}
void delay(unsigned int value)
   {
     unsigned int i,j;
     for(i=0;i<value;i++)      
     for(j=0;j<1275;j++);
   }

void serial(unsigned char x)
{
	SBUF=x;
	while(TI==0);
	TI=0;
}

void Send2Gsm(char *aaa)
{
     while(*aaa!='\0')
		 {
			 serial(*aaa);
			 aaa++;
     }
}




void main()
{

  serialcomm();
  Send2Gsm("AT\r\n");
  delay(2);
  Send2Gsm("AT+CMGF=1\r\n");
  delay(2);
  Send2Gsm("AT+CMGS=8762357075\r\n");  
  delay(2);
  Send2Gsm("Hello");
  serial(0x1a);

  }

when i tried this code,i am not getting SMS from the gsm modem.can anyone point out the mistakes in my code ??
 

have you tried a longer delay between the commands or even waiting for a response from the modem and checking it is OK or some error message?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top