CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

pic to gsm modem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
gorilla135



Joined: 14 Mar 2006
Posts: 8

View user's profile Send private message

pic to gsm modem
PostPosted: Wed Mar 22, 2006 7:18 am     Reply with quote

iam having a problem communicating a PIC 16f877 with a gsm modem, the problem is that the modem only works with 115200 baud rate, the code works perfectly when i connect the modem via hyperterminal but when i connect it to the PIC which has a lower baud rate it wont work. can anyone help please. thanks
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Mar 22, 2006 7:46 am     Reply with quote

Have you tried setting the modem to a lower baud rate?

AT+IPR=9600
and then make this change permanent with:
AT&w
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 22, 2006 8:31 am     Reply with quote

Post your PIC code. I find it hard to believe that the modem will not talk slower than that!
gorilla135



Joined: 14 Mar 2006
Posts: 8

View user's profile Send private message

PostPosted: Wed Mar 22, 2006 8:41 am     Reply with quote

#include <16F877.h> /* Defines chip */
#include <stdio.h> /* this gets the printf() definition */
#use delay(clock=4000000)
#fuses hs, noprotect, nowdt, nolvp
#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7, stream=GSM, ERRORS)


const int CR=0x0d;

void main()

{
fprintf(GSM,"AT\r\n"); /* checks are they communicating */
fprintf(GSM,"AT+CMGF=1\r\n"); /* sends an at command reay to send */
fputc(CR,GSM);
delay_ms(1000); /*sends a carriage return */
fprintf(GSM,"AT+CMGS=\"07749960685\""); /* sents the following text to this number */
fprintf(GSM,"\r\n"); /* cariage */
fputc(CR,GSM);

delay_ms(1000);
fprintf(GSM,"Hi world\r\n"); /* the text that will actually be sent */

/* sends CTRL Z */
delay_ms(1000);
fprintf(GSM,"\r\n");
fputc(0x1A,GSM); /* sends carriage return */
}
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 22, 2006 8:51 am     Reply with quote

You aren't waiting for the responses back from the modem.
gorilla135



Joined: 14 Mar 2006
Posts: 8

View user's profile Send private message

PostPosted: Wed Mar 22, 2006 9:03 am     Reply with quote

do i just put in a few delays or what,
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 22, 2006 9:09 am     Reply with quote

Do you read any other posts? Here's one that's current right now.

http://www.ccsinfo.com/forum/viewtopic.php?t=26427
gorilla135



Joined: 14 Mar 2006
Posts: 8

View user's profile Send private message

PostPosted: Wed Mar 22, 2006 9:33 am     Reply with quote

been searching for a day or two now. i just want the pic to send a text message at the minute then when i get that to work i want it to read a text message in and using the string compare function carry out a few operations if the command is correct,
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group