Reply To: PIC16F877A with GPS and GSM for tracking purpose

Home Forums Microcontrollers PIC Microcontroller PIC16F877A with GPS and GSM for tracking purpose Reply To: PIC16F877A with GPS and GSM for tracking purpose

#11044

Ligo George
Keymaster

Try using following functions.

void gsmInit()
{
  UART1_Init(9600);
  Delay_ms(200);
  UART1_Write_Text("ATE0\r"); // ECHO OFF
  Delay_ms(100);
  UART1_Write_Text("AT+CMGF=1\r"); // Text Mode
  Delay_ms(100);
  UART1_Write_Text("AT+CNMI=2,0,0,0,0\r");
  Delay_ms(100);
}

void gsmSendSMS(char mobile[11], char message[10])
{
  UART1_Write_Text("AT+CMGS=\"");
  UART1_Write_Text(mobile);
  UART1_Write_Text("\"\r");
  UART1_Write_Text(message);
  UART1_Write_Text(26);
  Delay_ms(100);
}