rahulmr
Junior Member level 1

Hi All,
I am doing a project using the SIM 900 and PIC16F877A. I am able to read the UART and send through UART as well. I am having ISR code which has 2 blocks,one handles the UART interrupt to store the serial data ,and another check for the RB0 interrupt.
I have enabled the INTE,GIE, RCIE=1 and PEIE=1;TRISB0=1, and TRISB1=0.
When the RB0 is connected to a switch using the pullup and when the switch is closed the interrupt is working and the LED is toggling .
When I send an SMS to this number ,UART is working fine as it displays everything from the SMS and nothing is happening to LED .. Looks OK.
When this RB0 is connected to the O/P of a PIR sensor(movement detection), and when movement noticed the LED toggles. This also works fine and interrupt works for INTF.
I have tested these with PIC16f877A in proteus with 20MHz and is working fine whereas in real time it is not working.
But the problem occurs when the RB0 is still connected to the PIR o/p, and when I send an SMS to this SIM900 module, the interrupt is happening for the LED as well. I am not sure how this INTF is getting triggered on the UART input/interrupt or when the RCIF is set.
I have tried many options of checking whether INTF and RB0=1 so as to disable the interrupt call to toggle the LED. But that also fails.
Is it like the INTF is always set when the RCIF is set or someother cases ?
Can someone help me with the problem ?
Thanks,
Rahul M R
I am doing a project using the SIM 900 and PIC16F877A. I am able to read the UART and send through UART as well. I am having ISR code which has 2 blocks,one handles the UART interrupt to store the serial data ,and another check for the RB0 interrupt.
I have enabled the INTE,GIE, RCIE=1 and PEIE=1;TRISB0=1, and TRISB1=0.
Code:
void interrupt ISR(void) {
if (RCIE && RCIF) {
USARTHandleRxInt();
return;
}
if (INTF) {
INTF = 0;
INTE = 0;
RB1 = ~RB1; -// to toggle an LED connected.
__delay_ms(3000);
sendSMS(); // Send an SMS.
}
}
When the RB0 is connected to a switch using the pullup and when the switch is closed the interrupt is working and the LED is toggling .
When I send an SMS to this number ,UART is working fine as it displays everything from the SMS and nothing is happening to LED .. Looks OK.
When this RB0 is connected to the O/P of a PIR sensor(movement detection), and when movement noticed the LED toggles. This also works fine and interrupt works for INTF.
I have tested these with PIC16f877A in proteus with 20MHz and is working fine whereas in real time it is not working.
But the problem occurs when the RB0 is still connected to the PIR o/p, and when I send an SMS to this SIM900 module, the interrupt is happening for the LED as well. I am not sure how this INTF is getting triggered on the UART input/interrupt or when the RCIF is set.
I have tried many options of checking whether INTF and RB0=1 so as to disable the interrupt call to toggle the LED. But that also fails.
Is it like the INTF is always set when the RCIF is set or someother cases ?
Can someone help me with the problem ?
Thanks,
Rahul M R