urgent! anyone how to modify below code regarding AT89c51 using AT command.

Status
Not open for further replies.

Ni yanfang

Member level 3
Joined
Jul 30, 2013
Messages
59
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
432
for hardware I am using AT89c51 connect with gprs modem.
Does anyone know how to modefity so that I can send one message to more people at the same time Please.
unsigned char Command_CMGS[]="AT+CMGS =+9233385xxxxx\r";
// recepient mobile number
unsigned char Command_AT[]="AT\r";
unsigned char msg02[]="I need your help !";
 

Have you select the Text mode for sending SMS?
unsigned char Command_CMGF[]=""AT+CMGF=1"
unsigned char Command_CMGS[]="AT+CMGS =";
unsigned char Command_CMGS1[]="+9233385xxxxx";
unsigned char msg02[]="I need your help !";
main()
{
Command_CMGF[];
0x0D //for ENTER KEY send HEX value
Command_CMGS[];
0x22 // for " this sign
Command_CMGS1[];// your receiver's no
0x22 // for " this sign
msg02[]
0x0D //for ENTER KEY send HEX value
0x1A // for Control+Z for sending sms
....
}
after Selecting text mode wait for some seconds as modem gives the reply as OK.
 


yes u have to select text mode...
Why you are sending 0x22?
 

OK Thank you so much.
sorry I did not explain clearly. I will use AT command but write in c language code. This is useful on explanation on AT command manual . But can i have sample?
 

Yes I did.
#include<at89x51.h> // include at89x51 . h
#include<stdio.h>// include stdio . h
#include<stdlib.h>// include stdlib . h
void initialize_GSM_modem(void);
void initialize_serialcommunication(void);
unsigned char Command_CMGF[]="AT+CMGF=1\r";
// AT+CMGF for selecting Text Mode
unsigned char CtrlZ=0x1A;
// CTRL+Z for sedning SMS after the message has been entered
unsigned char Command_CMGS[]="AT+CMGS =+9233385xxxxx\r";
// recepient mobile number
unsigned char Command_AT[]="AT\r";
unsigned char msg02[]="I need your help";
void delay(void){
unsigned int i;
for(i=0;i<50;i++);
}
void delay2(void){
unsigned int i;
for(i=0;i<25000;i++);
}
void main (void) {
initialize_GSM_modem();
initialize_serialcommunication();
while (1) {
;
}
}
void initialize_GSM_modem(void){
delay2();
puts(Command_AT);
delay2();
puts(Command_CMGF);
delay2();
puts(Command_CMGS);
delay2();
puts(msg02);
delay2();
while(!TI); TI = 0;SBUF = 0x1A;
}
void initialize_serialcommunication(void){
TMOD = 0x20;
SCON = 0x50;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
TI = 1;
}
This is my code. Kindly check for me. Isn't any error. Thanks.

- - - Updated - - -

It is for double quotes.
what is double quotes?
 

Double quotes is isolated the contact number, at+cmgs="+91XXXXXX"(Enter) is the format.
 
Double quotes is isolated the contact number, at+cmgs="+91XXXXXX"(Enter) is the format.
OK thank you

- - - Updated - - -

hello, can i have full sample code ?? Please.
 

you have to use \r\n at the end of each command in double quotes....
enter is nothing but \r\n....
also for sending msg u have just send ctrl+z..

- - - Updated - - -

you have to use \r\n at the end of each command in double quotes....
enter is nothing but \r\n....
also for sending msg u have just send ctrl+z..

- - - Updated - - -

also write isr for receiving response...
becauze after sending first command(AT) if modem sends OK then only you should send next command...
otherwise send AT only....
 

can i have full sample code please?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…