AT Command+Wavecom modem+MikroC

Status
Not open for further replies.

amila133

Member level 4
Joined
Oct 13, 2009
Messages
72
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Sri Lanka
Activity points
1,746
This program was used to send sms by PIC18F452 and Wavecom GSM modem.It was successful.

void send_sms(){
const unsigned char para[5]="AT\r\n";
const unsigned char textmode[12]="AT+CMGF=1\r\n"; //select pdu mode (o is given ; 1 is given for text mode)
const unsigned char smsc[23] ="AT+CSCA=\"+947500010\"\r\n" ; //message center no
const unsigned char recepient[24]="AT+CMGS=\"+94755352102\"\r";
//const unsigned char smsc[23] ="AT+CSCA=\"+947100003\"\r\n" ; //message center no
//const unsigned char recepient[24]="AT+CMGS=\"+94712870330\"\r";
const unsigned char message[3]="12";
//const unsigned char message1[3] =count;
// const unsigned char dial[17] ="ATD0712870330;\r\n";

Usart_Init(9600);
//TRISB=0;
//PORTB=0;



/* for( i=0;i<10;i++){
count++;
} */

for(i=0;i<5; i++){
Usart_Write(para); //type at
//Delay_ms(200);

}
//Usart_Write(0x0D); //enter
//Usart_Write(0x0A); //new line

// PORTB=1;
Delay_ms(1000);
// PORTB=0; //set textmode
for(i=0;i<12;i++) {

Usart_Write(textmode);
//Delay_ms(200);

}
//Usart_Write(0x0D);
//Usart_Write(0x0A);

//PORTB=1;
Delay_ms(1000);
// PORTB=0;

for(i=0;i<23; i++){ //SERVICE CENTER NO
Usart_Write(smsc);
//Delay_ms(200);

}
//Usart_Write(0x0D); //enter
//Usart_Write(0x0A); //new line

// PORTB=1;
Delay_ms(1000);
// PORTB=0;


for(i=0;i<24;i++) {
//if(command1=='\0') break;
Usart_Write(recepient); //recepinet no
//Delay_ms(50);

}
// Usart_Write(0x0D); //enter
Delay_ms(400);
// Usart_Write(count);
//Usart_Write(0x31);//1

for(i=0;i<3;i++){ //send message
// if(command1=='\0') break;
Usart_Write(countSMS);
Delay_ms(50);

}

//Usart_Write(count);

Usart_Write(0x1A); //ctrl+z

// PORTB=1;
Delay_ms(2000);
// PORTB=0;
Usart_Write(0x0D); //enter
//for(i=0;i<17;i++){ //dial really starting
// if(dial=='\0') break;
// Usart_Write(dial);
// // Delay_ms(200);
//
// }
// PORTB=1;
Delay_ms(250);
// PORTB=0;
}
 

I could not see your question, but congratulation Amila!!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…