programming pic board to send SMS messages

I have a PIC board with built in GSM capability (must insert valid SIM card into board) that i'm programming for a senior design project. 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.

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;
}
I am in the exact same position as you flyboya. i don't have a solution to this problem yet but when i make some progress i will post on here again. another part of our project will be to receive text messages as well. the example code doesn't seem to do this, so that will be the next thing to accomplish for me. does anyone know how to read the text messages off of the sim card?
Mattpol, shoot me an e-mail so we can stay in touch. adl505@gmail.com. If anyone else has any sort of input or advice please post away...
here is the send protion. please help with receiving/reading texts from the sim card


int send_txt()
{
//char mess = "HEY";
char mess1[4] ={'h', 'e', 'y', };
int timeout = 7000;
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]='+';
tmp[10]='1';
tmp[11]='2';
tmp[12]='1';
tmp[13]='9';
tmp[14]='7';
tmp[15]='4';
tmp[16]='2';
tmp[17]='9';
tmp[18]='3';
tmp[19]='6';
tmp[20]='1'; // put your phone number in here
tmp[21]='"';
tmp[22]='\0';
SendUART2(tmp);

//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(mess1);
}//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;
}
Topic archived. No new replies allowed.