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 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 - - -
what is double quotes?