|
|
View previous topic :: View next topic |
Author |
Message |
angela Guest
|
pic-gsm |
Posted: Tue Apr 14, 2009 1:41 pm |
|
|
I have a PIC(18F97j60) board with built in GSM capability (must insert valid SIM card into board) that I'm programming. The board came bundled with code, however the code didn't seem to be correct because I can not get the damn thing to send a text message. If you look at the code, the send_sms function along with many of the other functions were set up with the use of a web form in mind (as a means of data input (phone number and message content). However, I simply want to hard code the sms number and message and have the board send a text once it's powered on. You can see that's what I tried to do in the send_sms function, but there is something not right. I'm thinking its my AT command syntax. Any help would be greatly appreciated since i'm not a programmer but I do have to complete this task.
Code: |
int send_sms(char * number,char * message,int timeout)
{
int tmt=timeout;
//int k=sizeof(LCDText);
/*
tmp[0]='A';
tmp[1]='T';
tmp[2]='+';
tmp[3]='C';
tmp[4]='M';
tmp[5]='G';
tmp[6]='S';
tmp[7]='=';
tmp[8]='"';
tmp[9]='+';
//memcpy(tmp+10,LCDText,number_length);
memcpy(tmp+10, number, number_length);
tmp[number_length+10]='"';
tmp[number_length+11]='\0';
*/
//SendUART2(tmp);
//SendUART2("AT+CMGF=1");
//SendUART2("AT+CMGS=\"9086161265\"");
//SendUART3(message);
SendUART("AT");
SendUART("AT+CMGF=1");
SendUART("AT+CMGS=\"+19086161265\"");
SendUART3("TEST");
//add handle for custom GSM number
a=65535;
//while(--a!=0);
if (rx_counter != 0)
{
while(!(proba == '>')) //HERE sending SMS works
proba=getchar_UART(70000);
SendUART3(message);
}//end sending
//if(!waitplus(7000))
return 0;
do
{
proba=getchar_UART(70000);
a=a;
}
while((proba != 10)&& (--timeout!=0)); //skip first line, read message text on second line
if(!waitOK())
return 0;
a=65535;
return 1;
}
|
Please help with receiving/reading texts from the sim card. Does anyone know how to read the text messages of the sim card?
with regards, Ada |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 14, 2009 1:56 pm |
|
|
Quote: |
SendUART("AT+CMGS=\"+19086161265\"");
SendUART3("TEST"); |
This is probably C18 compiler code. It look like you copied it from here:
http://www.gidforums.com/t-20863.html
Do you have the CCS compiler ? It's not directly compatible with the
Microchip C18 compiler.
If you do have the CCS compiler, then use the forum's search page to
search for: GSM
http://www.ccsinfo.com/forum/search.php
I did that and I got 150 hits. Try it. |
|
|
|
|
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
|