raushankumar586
Junior Member level 1
Hello guys, I am trying to send AT commands to Sim800 module from Pic18f4520 and want to very my command has been send and Sim800 is responding back with an OK.
For that I made : -
>>sim800 - pic18f4520 -------- uart connection
>>pic18f4520 - Arduino mega 2560 ---------- I2C connection* (To see Whats going on between pic and sim800 in serial monitor)
>> A string Compare Function
>> \r\n finder Function
>> Delay using timer0 of pic
so here are my code looks like
I checked my stringCompare function in netbeans by giving inputs its working fine. Even here program working fine untill
printToArduino("--------------System Started----------");
If I remove this line then program is not stucking anywhere but whenever I de-comment this line program stucks.
I checked using debugger compareReturn1 and compareReturn2 both are set to 1. but still inside this if condition printToArduino() is not working .....where It is working for
printToArduino("---Checked for AT ---\r\n");
help me , I know its a silly question and very easy to figure it out but I am not getting whats wrong with it.
For that I made : -
>>sim800 - pic18f4520 -------- uart connection
>>pic18f4520 - Arduino mega 2560 ---------- I2C connection* (To see Whats going on between pic and sim800 in serial monitor)
>> A string Compare Function
>> \r\n finder Function
>> Delay using timer0 of pic
so here are my code looks like
Code:
while (1) {
checkSysConneciton(); // sending AT\r\n
delay(10); // delay of 128 ms * 10
reading_and_printingArduino(); // reading buffer and printing to arduino mega 2560
compareReturn1 = stringCompare(checkAT, buffer, 0, 2); // serching for AT --- 0,2 //are start and endpoint of buffer responding back from sim800
if (compareReturn1 == 1) {
delay(1);
printToArduino("---Checked for AT ---\r\n");
compareReturn2 = stringCompare(checkOK, buffer, 3, 5); // serching for AT
if(compareReturn2 ==1){
delay(1);
printToArduino("--------------System Started----------");
}
delay(1);
}
}
I checked my stringCompare function in netbeans by giving inputs its working fine. Even here program working fine untill
printToArduino("--------------System Started----------");
If I remove this line then program is not stucking anywhere but whenever I de-comment this line program stucks.
I checked using debugger compareReturn1 and compareReturn2 both are set to 1. but still inside this if condition printToArduino() is not working .....where It is working for
printToArduino("---Checked for AT ---\r\n");
help me , I know its a silly question and very easy to figure it out but I am not getting whats wrong with it.