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 support@ccsinfo.com

send SMS to multiple phone numbers
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PrinceNai



Joined: 31 Oct 2016
Posts: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Wed Nov 02, 2016 9:00 am     Reply with quote

benoitstjean wrote:
The reason is that some responses have the 'OK' embedded in them and others the 'OK arrives later, in some other cases you get 'OK' followed by another response. So there is no consistency between messages and it can get confusing.



Yeah, I found that one out when trying to figure out why "AT+CREG?" didn't work. I'm using state machine to decipher the answers from the modem and delayed "OK" as the answer to this command fooled my state machine into wrong state :-).
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Wed Nov 02, 2016 5:56 pm     Reply with quote

I've been doing sms/gsm projects for about 9 years.
I've never had an issue with my modems doing sms rapid fire... i do wait for the OK response though.
The code provided was meant as a starting point, not as a fool proof solution.

I mostly deal with Telit chips... and i guess it also depends what your definition of FAST is.
The receiver is almost never aware of when the others on the list get the sms.... so in all recipients eyes, they got the sms "instantly".
_________________
CCS PCM 5.078 & CCS PCH 5.093
PrinceNai



Joined: 31 Oct 2016
Posts: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Thu Nov 03, 2016 4:39 pm     Reply with quote

Dear sirs, success :-).

You really have done all the hard work, I just needed to punch in a couple of lines.

Code:

// Send status SMS to all cell phone numbers stored in EEPROM
void Send_Status_To_All(){
   int8   Offset = 0;
   ComposeMessage(SMS_Message);
   for (Offset = 0; Offset < 32; Offset = Offset +16){
      EEPROM_GET(GSM_NUMBER,16,Offset);
      Send_Msg(SMS_Message);
   }
   Offset = 0;
}


and

Code:

// Send SMS
void Send_Msg(char* Msg){

      fprintf(GSM,"AT+CMGS=\"%s\"\r\n",GSM_NUMBER);
       Wait_response(GSM_Ready_To_Receive_Message); // wait for "> "
       GSM_Send(Msg);
 //      Wait_response(GSM_OK);
       Wait_response(SMS_SENT);                     // wait for "+CMGS"
}



Thank you all very much.

Btw, AT+CMGSO command doesn't work on SIM900.
benoitstjean



Joined: 30 Oct 2007
Posts: 542
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Thu Nov 03, 2016 4:52 pm     Reply with quote

True, I just looked at the docs and AT+CMGSO does not work on SIM900. But I did confirm with SIMCom and you _must_ wait for +CMGS response after sending otherwise, you may end-up with errors. The modem can only queue 2 SMS I think. But the best practice is to wait for +CMGS.

Good work and good luck.

Ben
lahcen



Joined: 17 Jan 2022
Posts: 1
Location: Morocco

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

PostPosted: Mon Jan 17, 2022 9:52 am     Reply with quote

Hi PrinceNai I have same project, Thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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