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.

pic interface with gsm

Status
Not open for further replies.

shri devi

Junior Member level 1
Joined
Dec 9, 2010
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,407
Here i have send a code, to send a message from gsm to mobile but it does not work can anybody help me please.
#include <16f877a.h>
#include <stdio.h>
#use delay (clock = 20000000)
#fuses hs, noprotect, nowdt, nolvp
#use rs232(baud=9600, bits=8, xmit=pin_c6,rcv=pin_c7, parity=n, stream=GSM)
void main ()
{
set_tris_b(0);

fprintf(GSM,"at\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
delay_ms(100);

fprintf(GSM, "at+cmgf=1\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
delay_ms(100);

fprintf(GSM,"at+csmp=17,168,0,0\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
delay_ms(100);

fprintf(GSM, "at+cmgs=\"+*******\"\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
delay_ms(100);

fprintf(GSM, "TEST1..");
delay_ms(100);
fputc(0x1A,GSM);
delay_ms(100);

}
 
Last edited:

are you ordering people here to help you or requesting us to help you?????????
Maybe this is not the way of asking for help when you need help....

This is not a place where readymade products are delivered... first do a search on the forum. you will get enough materials here.
if you dont get any help after search and still you expect help, then tell what you have done till now and where you are struck, .... dont expect spoon feeding here..
 

thanks for your advice and edited my post can anyone help me i am using mplab ide
 

does this program work with hyperterminal.. connect the controller UART to PC and see if the controller sends command properly...

where are you waiting for the response from the modem.. there is no code for waiting for response.. you are simple sending commands bit not waiting for OK response....
 

the above code works with hyper terminal.Here i changed based on your idea but this too does not work why? please help me with this
#include <16f877a.h>
#include <stdio.h>
#use delay (clock = 20000000)
#fuses hs, noprotect, nowdt, nolvp
#use rs232(baud=9600, bits=8, xmit=pin_c6,rcv=pin_c7, parity=n, stream=GSM)
void main ()
{
set_tris_b(0);

fprintf(GSM,"at\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgets(GSM);
delay_ms(100);

fprintf(GSM, "at+cmgf=1\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgets(GSM);
delay_ms(100);

fprintf(GSM,"at+csmp=17,167,0,0\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgets(GSM);
delay_ms(100);

fprintf(GSM, "at+cmgs=\"+919487289393\"\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgets(GSM);
delay_ms(100);

fprintf(GSM, "TEST1..");
delay_ms(100);
fputc(0x1A,GSM);
fgets(GSM);
delay_ms(100);

}
 

Did you check the GSM with hyperterminal.. Is it working properly to AT commands.... Is the GSM baud rate also 9600?

check if you used same serial cable to test gsm modem with terminal and PIC board with terminal.....
Use the same cable to connect PIC boars and GSM... and try to communicate... If they dont communicate then interchange the tx and rx on one side of the cable and try it should work.......
 

I am using male connector on both side to connect max232 and gsm modem how to interchange
 

Interchange pin 2 and pin 3 connection on one end of cable...

Did you use the same cable to test gsm modem and pin controller program using PC ????

---------- Post added at 13:35 ---------- Previous post was at 13:34 ----------

when testing the pic program... did you type OK from hyperterminal as response in the absence of modem.. Was the program waiting for the OK response from terminal???
 

i checked with hyperterminal and solved the problem but when i connect pic and gsm with male to male connector it is not sending the message.I used to connect hyperterminal and pic using male and female connector. whether we have to use any other header file to connect gsm and pic.
 

did you try changing tx and rx connection at one end of cable.... dont forget to connect pin 5 to pin 5 of both cnnectors.

what is the power supply you are using???
you should use different power supply for PIC board and GSM....
 

#include <16f877a.h>
#include <stdio.h>
#use delay (clock = 20000000)
#fuses hs, noprotect, nowdt, nolvp
char a,b,c,d,o,i;
#use rs232(baud=9600, bits=8, xmit=pin_c6,rcv=pin_c7, parity=n, stream=GSM)
void main ()
{
set_tris_b(0);


fprintf(GSM,"at\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgetc(GSM);
putc(GSM,a);
if(a=o)
{
fgetc(GSM);


fprintf(GSM, "at+cmgf=1\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgetc(GSM);
putc(GSM,b);
if(b=o)
{
fgetc(GSM);


fprintf(GSM,"at+csmp=17,168,0,0\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgetc(GSM);
putc(GSM,c);
if(c=o)
{
fgetc(GSM);


top:
fprintf(GSM, "at+cmgs=\"+919487289393\"\r\n");
fputc(0x0D,GSM);
fputc(0x0A,GSM);
fgetc(GSM);
putc(GSM,d);
if(d=o)
{
fgetc(GSM);


fprintf(GSM, "TEST1..");
fputc(0x1A,GSM);

}
else
{
for(i=0;i<=4;i++)
{
fgetc(GSM);
}
goto top;
}
}
}
}
}

whether this code works can anybody help me
do anyone has sample program for keypad and lcd interface wih pic
 

did you not check this code on hyperterminal as i had told you ????????
if yes, then tell me how you tested it.. you will only know if code is correct or not...............
 

i checked but it is not getting ok message when i typed. it is not going to next step itself
 

modify this logic for your program.. I dont see you waiting for any response from modem and you dont do anything after you get response.... need to wait for OK from modem..
while testing you type OK on terminal window.

e.g.
gsmcmdsend(gsm_cmd5); //clear the SIM memory
while(Rx_data()!='O');
while(Rx_data()!='K'); //waiting for the modem response
 

sir I am working on a similar project but today I encountered a silly problem and I need some help, I am having sim300 modem and I wanted to check it using AT commands by connecting with windows. I am having BF810 USb-serial converter but can't connect it to the modem because of the bigger hinges on both sides of the converter. So is there any way out or I have to connect directly using the TXD and RXD pins?
 

You can remove the hinges using cutting plyer by unscrewing it ( rotating it) not breaking... I cant guarentee modem functionality with USB to serial cable...... try it

---------- Post added at 21:37 ---------- Previous post was at 21:36 ----------

you can buy 2 9 pin d type connector and solder pin 2,3 5 on both sides......
 

can anybody give me an example to send and receive a message from GSM and display it on lcd

---------- Post added at 13:55 ---------- Previous post was at 13:50 ----------

can anybody give me a example to send and receive message and display it on lcd using ccs compiler
 

ccs compiler is not accepting

gsmcmdsend(gsm_cmd5);
what to do please help

whether we have include any header files for gsm
 

whether we have to decode the message for receiving purpose plz help...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top