I have been trying to send SMS using an SIM300 module. Though module is working fine when tried using Hyper Terminal, but i am not able to send the SMS using PIC.
Below is the code that i tried (LCD also included (Lcd is working fine)):
Programming: MikroC
Controller : PIC16f877A
Module: SIM300
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D4 at RB0_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
void main(){
//CMCON = 7; //Disable Comparators
Lcd_Init(); // Initialize LCD
UART1_init(9600); //Initiate baud rate to 9600
Delay_ms(500); //Delay
UART1_Write_Text("AT+CMGF=1"); //Write "AT+CMGF=1"
UART1_Write(0x0D); // mean (ENTER)
Delay_ms(500); //Delay
UART1_Write_Text("AT+CMGS="); //Write "AT+CMGS="
UART1_Write(0x22); //Write (")
UART1_Write_Text("9449869619"); //Number SMS send to
UART1_Write(0x22); //Write (")
UART1_Write(0x0D); // mean (ENTER)
Delay_ms(500); //Delay
UART1_Write_Text("WELCOME");
UART1_Write(0x0D); //Words to be sent
UART1_Write(0x1A);
//Write "ctrl+z"
Delay_ms(500); //Delay
Lcd_Out(1,1,"MSG SENT SUCESSFULLY"); // Write text in first row
}