PDA

View Full Version : How do i Send Multiple SMS messages?



isaac
- 10th April 2012, 13:36
Hello All

i am presently working on a project which has to send SMS msg when certain conditions are reached.
this works fine as you can see from the code here.
my question is "Is it possible to send the same SMS msgs to say 5 different mobile phone numbers without having to do 5 different subs
as i need to notify 5 different mobile numbers which the same message.

Regards
Isaac




SMS:
HSEROUT[ "AT" ,13] 'Sending "AT" and Carraige return to GSM module
' If its ok, the it will send a response back : "OK"
HSERIN 5000, SMS,[WAIT("OK")] ' wait for response ok for 5 seconds
' if it times out, it will go back to SMS and retry

'If GSM Module is OK, will send response "OK"
' Other wise it will go back to SMS and retry
HSEROUT["AT+CMGF=1",13] 'Here the GSM module is being entered in TEXT MODE.
HSERIN 5000, SMS,[WAIT("OK")] ' wait for response ok for 5 seconds
' if it times out, it will go back to SMS and retry
HSEROUT[ "AT+CMGS=+4475--------"] 'Here the GSM module is told the desitnation phone number.
'This is done by sending string "AT+CMGS= desitnation mobile number"

HSEROUT[13]
HSERIN 5000 , SMS, [WAIT(">")]
HSEROUT[ " Battery Volts too Low" ,10,13]'result

HSEROUT[ 26] ' this is ASCII for Ctrl+Z
HSERIN 15000 , SMS,[WAIT("+CMG")]
'Here we are waiting for a string CMG. If that is received it means that the message
'has been transmitted successfuly!
LCDout I, Clr
lcdout I,Line1+3," Batt Alert "
lcdout I,Line2+2," SMS MSG Sent to"
lcdout I,Line3+2," +4475---------- "
lcdout I,Line4+4," Msg sent OK"
LOW GSM_EN
pause 500
return

aratti
- 13th April 2012, 22:10
Issac, You should write your numbers to eeprom. Say first number form location 0 to 15 (assuming your phones numbers of 15 digits), the 2nd from 16 to 30 and so on.

Than you will write the start and end reference in an array byte.

Start[0]=0 ; Last[0]=15 - Start[1]=16; Last[1]=30 ..... And so on.

Than you make a loop for/next to repeat the number

For call_numb=0 to 4

Hserout "AT+CMGS="

For num = Start[call_numb] To Last[call_numb]
Read num,send
Hserout Send
Next num
.
.
Here your code till Hserin 15000, SMS.....
.
Next call_numb

It should work

Cheers

Al.