santoshhiremani
Newbie level 4
Hi,
I'm working on an GSM module SIM300 which works fine when i test in windows terminal but when try to send message from PIC18F2550, not able get message from it it is my code
void main(void)
{
//Configuration of Modem
ADCON1 = 0x0F; // default all pins to digital
TRISC = 0b11000000; // RC7(RX) as input , RC6(TX) as output
TRISA = 0b00000000;
TRISB = 0b00000000;
OSCCON = 0b01110110; //select 8 MHz clock
OpenUSART (USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 51);
putrsUSART((const far rom char *)"AT\r\n");
Delay10KTCYx(500);
putcUSART(0x0D);
while(!BusyUSART());
//50x10k instruction cycle = 0.5s delay
putrsUSART((const far rom char *)"AT+CMGF=1\r\n"); //Operatng in SMS text mode
Delay10KTCYx(500);
putcUSART(0x0D);
while(!BusyUSART());
Delay10KTCYx(500); //50x10k instruction cycle = 0.5s delay
putrsUSART((const far rom char *)"AT+CMGS=\"+917411901273\"\r"); //Sending SMS to recipant
Delay10KTCYx(500);
putcUSART(0x0D);
putcUSART(0x0D);
putrsUSART((const far rom char *)"\n\r");
Delay1KTCYx(500);
putcUSART(0x3E);
while(!BusyUSART());
Delay10KTCYx(500); //50x10k instruction cycle = 0.5s delay
putrsUSART((const far rom char *)"Hello"); //message to be sent
while(!BusyUSART());
Delay10KTCYx(500); //50x10k instruction cycle = 0.5s delay
putcUSART(0x1A);// send ctrl + Z
Delay10KTCYx(1000);
CloseUSART();
//}
}
when i see out put of microcntroller in terminal i got following response
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
I'm working on an GSM module SIM300 which works fine when i test in windows terminal but when try to send message from PIC18F2550, not able get message from it it is my code
void main(void)
{
//Configuration of Modem
ADCON1 = 0x0F; // default all pins to digital
TRISC = 0b11000000; // RC7(RX) as input , RC6(TX) as output
TRISA = 0b00000000;
TRISB = 0b00000000;
OSCCON = 0b01110110; //select 8 MHz clock
OpenUSART (USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 51);
putrsUSART((const far rom char *)"AT\r\n");
Delay10KTCYx(500);
putcUSART(0x0D);
while(!BusyUSART());
//50x10k instruction cycle = 0.5s delay
putrsUSART((const far rom char *)"AT+CMGF=1\r\n"); //Operatng in SMS text mode
Delay10KTCYx(500);
putcUSART(0x0D);
while(!BusyUSART());
Delay10KTCYx(500); //50x10k instruction cycle = 0.5s delay
putrsUSART((const far rom char *)"AT+CMGS=\"+917411901273\"\r"); //Sending SMS to recipant
Delay10KTCYx(500);
putcUSART(0x0D);
putcUSART(0x0D);
putrsUSART((const far rom char *)"\n\r");
Delay1KTCYx(500);
putcUSART(0x3E);
while(!BusyUSART());
Delay10KTCYx(500); //50x10k instruction cycle = 0.5s delay
putrsUSART((const far rom char *)"Hello"); //message to be sent
while(!BusyUSART());
Delay10KTCYx(500); //50x10k instruction cycle = 0.5s delay
putcUSART(0x1A);// send ctrl + Z
Delay10KTCYx(1000);
CloseUSART();
//}
}
when i see out put of microcntroller in terminal i got following response
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"
>HelloAT
AT+CMGF=1
AT+CMGS="+917411901273"