Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Send SMS from PIC to GSM Modem

Status
Not open for further replies.

peter2020

Newbie level 2
Joined
Aug 19, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Malaysia
Activity points
1,294
Currently I'm doing on a project interfacing PIC16F877 with GSM Modem (MOD9001).
However, I failed to send sms from the PIC through the GSM Modem.
Is there anyone can help me to check on my coding? Am I doing the wrong coding?
The following is my coding:

#include <16f877a.h>
#include <stdio.h>
#use delay (clock = 20000000)
#fuses hs, noprotect, nowdt, nolvp
#define use_portb_lcd true
#use rs232(baud=9600, bits=8, xmit=pin_c6,rcv=pin_c7, parity=n, stream=GSM)

#byte portb=6
#byte portc=7
#byte portd=8

void main ()
{
set_tris_b(0);

fprintf(GSM,"at\r\n");
delay_ms(1000);

fprintf(GSM, "at+cmgf=1\r\n");
delay_ms(2000);

fprintf(GSM,"at+csmp=17,168,0,0\r\n");
delay_ms(2000);

fprintf(GSM, "at+cmgs=\"+601xxxxxx\"\r\n"); //xxxxxx is my phone #
delay_ms(2000);

fprintf(GSM, "TEST1..");
delay_ms(5000);

putc(0x1A);
delay_ms(5000);

}
 

GSM Man

Banned
Joined
Apr 15, 2009
Messages
671
Helped
168
Reputation
338
Reaction score
94
Trophy points
1,308
Location
New Jersey, USA
Activity points
0
You should not be depending on fixed delays between commands, rather you should receive the response from the module and process it. If you look at the responses from the module it may provide an answer to you problem

How do you know if you're even communicatiing with the module? How do you know that you are not receiving an error from the module for one of your commands? Is the SMS Message Center Number set - "AT+CSCA" command? Has the module registered with the network?
 

    V

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top