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.

Interfacing GSM with LPC2148

Status
Not open for further replies.

Twisted_transistor

Member level 1
Joined
Sep 13, 2012
Messages
32
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
1,478
HI.. This is the code I've written to send an sms via the GSM modem interfaced with LPC2148.. But however the number to which the message has to be sent does not receive any message..
Can someone pls help me understand why this is happening?

This is the code:

Code:
#include "LPC214x.h"
void init(void);
extern unsigned char cmgf[]="AT+CMGF=1";	                        //Text format in GSM modem
extern unsigned char cmgs[]="AT+CMGS=\"##########\"";           	//Mobile number to which the msg is sent
extern unsigned char msg[]="Hello";						 		   //secret code


void senduart1(unsigned char a)					//sends a byte through U1
{
U1THR=a;
while(U1LSR!=0x60);
}

void sendstring(unsigned char *p)			 //Sends a string of data through UART1
{
while(1)
{
if(*p=='\0') break;
senduart1(*p++);
}
}

void delaygsm()							  //delay function
{
int i,j;
for(i=0;i<60000;i++)
for(j=0;j<51;j++);
}

int main()
{
PINSEL0=0x00050005;			//initialized U0 and U1 as UART and not GPIO
PINSEL1 = 0x00000000;
PINSEL2 = 0x00000000;
init();


sendstring(cmgf);
senduart1(0x0d);										// equivalent of 
senduart1(0x0a);										//	 enter key
delaygsm();
sendstring(cmgs);
senduart1(0x0d);
senduart1(0x0a);	 
delaygsm();
sendstring(msg);
senduart1(0x1a);

}


void init()
{
 
U1LCR=0x83; //8-N-1, enable divisors
U1DLL=0x62; //9600 baud (9615)
U1DLM=0x00;
U1LCR=0x03; //8-N-1, disable divisors
}

I'm using SIM300 by the way.
Thanks in advance :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top