Nikunj Tanna
Advanced Member level 4
- Joined
- Dec 8, 2009
- Messages
- 115
- Helped
- 23
- Reputation
- 46
- Reaction score
- 15
- Trophy points
- 1,298
- Location
- Ahmedabad, Gujarat, India
- Activity points
- 1,985
Hi,
I am working for sending and receiving SMS from SIM900A to PIC16F877A. I have usd isr to receive the response from SIM900A. It seems that the firmware goes into isr when the character is received but I am not able to fully store the received message in an array. I am pasting the ISR and initialization part. Any help or suggestions is appreciated.
I have tried with if(RCIF == 1) and also with if(RCIF==1 && RCIE ==1) but no luck. It seems that RCREG is not storing the data.
I have also tried to check OERR and FERR bits but when I put them in code they goes in to the loop and restarts the USART almost every time. What should be the right procedure to avoid Overrun errors?
- - - Updated - - -
Thanks andre_teprom for editing. I will take care of these things in future.
I am working for sending and receiving SMS from SIM900A to PIC16F877A. I have usd isr to receive the response from SIM900A. It seems that the firmware goes into isr when the character is received but I am not able to fully store the received message in an array. I am pasting the ISR and initialization part. Any help or suggestions is appreciated.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 void interrupt isr(void) // Here be interrupt function - the name is { unsigned char data,temp; while(!RCIF) continue; if(RCIF = 1) { RCIE = 0; data = RCREG; Rxdata[index] = data; index++; if(index == 80) index = 0; } RCIE = 1; }
I have tried with if(RCIF == 1) and also with if(RCIF==1 && RCIE ==1) but no luck. It seems that RCREG is not storing the data.
I have also tried to check OERR and FERR bits but when I put them in code they goes in to the loop and restarts the USART almost every time. What should be the right procedure to avoid Overrun errors?
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 if(OERR) { CREN = 0; CREN = 1; } if(FERR) { TXEN = 0; TXEN = 1; } }
- - - Updated - - -
Thanks andre_teprom for editing. I will take care of these things in future.
Last edited by a moderator: