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.

p18f4520 to sent sms through Modem

Status
Not open for further replies.

applecrepe

Newbie level 4
Joined
Aug 7, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
Hi,

About my project is that it allow user to key in their phone number using keypad. Then once the switch is on it will sent a sms to the user.
But It cannot sent out to the user.

Below are my codes for the modem:
Code:
//Initializing Modem and send message
	putrsUSART((const far rom char *)"AT\r\n");
	while(!BusyUSART())
	Delay10KTCYx(50);					//50x10k instruction cycle = 0.5s delay 

	putrsUSART((const far rom char *)"AT+CMGF=1\r\n"); 	//Operatng in SMS text mode
	while(!BusyUSART());
	Delay10KTCYx(50);					//50x10k instruction cycle = 0.5s delay

	putrsUSART((const far rom char *)"AT+CNMI=2,1,0,0,1\r\n"); 	//setting for reading SMS
	while(!BusyUSART());
	Delay10KTCYx(50);					//50x10k instruction cycle = 0.5s delay

     putrsUSART((const far rom char*)"AT+CMGS=");
putcUSART(0x22);
putsUSART(input_number);
putcUSART(0x22);

	putrsUSART((const far rom char *)"TEST WITH KEYPAD\x1A\n");	//message to be sent
	while(!BusyUSART());
	Delay10KTCYx(50);					//50x10k instruction cycle = 0.5s delay 

//LED blink alternately to indicate SMS is sending
	LEDSMS = 0;				//toggle PORTB content(off)
	Delay10KTCYx(100);			//50x10k instruction cycle = 0.5s delay
	LEDSMS = 1;				//toggle PORTB content(on)
	Delay10KTCYx(100);			//50x10k instruction cycle = 0.5s delay
	LEDSMS = 0;				//toggle PORTB content(off)
	Delay10KTCYx(100);			//50x10k instruction cycle = 0.5s delay
	LEDSMS = 1;				//toggle PORTB content(on)
	Delay10KTCYx(100);			//50x10k instruction cycle = 0.5s delay
	LEDSMS = 0;				//toggle PORTB content(off)

	LEDSMS = 0;				//Reset PORTB
	Delay10KTCYx(100);			//50x10k instruction cycle = 0.5s delay

The ( input_number ) are the number that the user keyed in and is stored inside.

Need help, Thanks.
 

Did you check that your string is formated well? Check what modem gets from uart.
 

Better way first learn the AT Commands, Download the AT commands for Nokia Phone.

Second thing,Connect your phone with PC using Serial Cable.
Open the Hyper Terminal and write down the AT commands and check the behavior.
 

Thanks for the reply.

For the below code I can received the SMS:

Code:
putrsUSART((const far rom char *)"AT+CMGS=\"xxxxxxxx\"\r"); //Sending SMS to recipant 
	while(!BusyUSART());
	Delay10KTCYx(50);					//50x10k instruction cycle = 0.5s delay

but when I use the below code, I cannot received the SMS:
Code:
putrsUSART((const far rom char*)"AT+CMGS=");
putcUSART(0x22);
putsUSART(input_number);
putcUSART(0x22);

I declare the input_number as char input_number[8]
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top