Mrunal Ahirrao
Full Member level 2
- Joined
- Nov 26, 2012
- Messages
- 133
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- India
- Activity points
- 2,213
Hi everyone,
I am reading a string as response from SIM 300 GSM module. The string transmitted by GSM module is "RING" so I am using UART1_Read_text library function.I am using PIC16F628A and I am able to send SMS, dial calls etc,but as a beginner in serial communication I am unable to read/ detect the RING indicator from SIM300. Any help would be highly appreciated.I am using MikroC Pro for PIC and Here is my code:
I am reading a string as response from SIM 300 GSM module. The string transmitted by GSM module is "RING" so I am using UART1_Read_text library function.I am using PIC16F628A and I am able to send SMS, dial calls etc,but as a beginner in serial communication I am unable to read/ detect the RING indicator from SIM300. Any help would be highly appreciated.I am using MikroC Pro for PIC and Here is my code:
Code:
/* Testing connection with SIM300*/
sbit LED at RB4_bit;
//char receive;
char RX[]=;
//char SR[];
//unsigned short i;
void main()
{
CMCON=0x07;
TRISA=0;
TRISB=0b00000010;
LED=0;
/*output[1]=' ';
output[2]=' ';
output[3]=' ';
output[4]=' ';*/
delay_ms(60000);//delay to let SIM300 ready
UART1_Init(9600);
UART1_Write_Text("AT\r");
Delay_ms(2000);
while(1)
{
if(UART1_Data_Ready() == 1)
{
UART1_Read_Text(&RX,"\r\n",6);
}
Delay_ms(2000);
if((RX[1]=='R')&&(RX[2]=='I')&&(RX[3]=='N')&&(RX[4]=='G'))
{
UART1_Write_Text("ATH\r");
LED=~LED;
RCREG=0; //Set receive registry to zero
}
}
}