rahulmr
Junior Member level 1

I am creating a GSM project with GSM input to RX/TX of the PIC16F877A .Also I am using a PIR sensor which outputs 3 v and is connected to RB0 .
INTEDG is set to 1.When an interrupt happens, an LED is made to toggle.
I have a few problems here :
When the RB0 is connected to 5v using a switch, then only when switch is closed, the interrupt is fired and I see the LED toggled. Even when I make some UART interrupts either by making a call or sending SMS nothing happens to the LED.It works perfectly as there is no interrupt happening.
But when this RB0 is connected to the O/p of the PIR sensor, then normally only when a motion is detected the interrupt is fired and LED toggles.
But I face a problem now that when a call or SMS is sent so that UART is activated then the interrupt is fired for the RB0 as well.The PIR sensor is covered by a paper box so as to make sure no movement is detected.
I have noticed the voltage at RB0 at this moment and is 3V now from 0.
I am not sure why when there is UART signals coming in, there is interrupt fired and why the RB0 is set to high from 0 at that time eventhough the PIR is covered to prevent motion detectio.
I have disabled all other interrupts RBIE and timer interrupts as well. I have tried to trigger RB0 on low edge trigger by setting INTEDG=0 also powring RB0 with 5v and on movement detection the voltage drops to 0. But even in this case when UART is interrupted , the RB0 fires and the voltage at RB0 drops from 5V to 0v.
I have tried with 2 microcontrollers hoping the problem is with PIC but it same in each case.
I also tried setting RA0 as input instead of RB0 and in the main while loop checks whether RA0=1. This also works normally and when motion is detected, RA0 is set with 1 and the LED toggles.Here no interrupt logic is used for PIR output. But here as well on UART interruption the RA0 is set to high and LED toggles.
I somehow believe that whatever the case is when the UART is interrupted the LED toggles in the method which is supposed to call only when RA0 or RB0 is set.
I also see when i move my finger aroun the RB pins the interrupt is fired. Is it somekind of noise or something ?
INTEDG is set to 1.When an interrupt happens, an LED is made to toggle.
I have a few problems here :
When the RB0 is connected to 5v using a switch, then only when switch is closed, the interrupt is fired and I see the LED toggled. Even when I make some UART interrupts either by making a call or sending SMS nothing happens to the LED.It works perfectly as there is no interrupt happening.
But when this RB0 is connected to the O/p of the PIR sensor, then normally only when a motion is detected the interrupt is fired and LED toggles.
But I face a problem now that when a call or SMS is sent so that UART is activated then the interrupt is fired for the RB0 as well.The PIR sensor is covered by a paper box so as to make sure no movement is detected.
I have noticed the voltage at RB0 at this moment and is 3V now from 0.
I am not sure why when there is UART signals coming in, there is interrupt fired and why the RB0 is set to high from 0 at that time eventhough the PIR is covered to prevent motion detectio.
I have disabled all other interrupts RBIE and timer interrupts as well. I have tried to trigger RB0 on low edge trigger by setting INTEDG=0 also powring RB0 with 5v and on movement detection the voltage drops to 0. But even in this case when UART is interrupted , the RB0 fires and the voltage at RB0 drops from 5V to 0v.
I have tried with 2 microcontrollers hoping the problem is with PIC but it same in each case.
I also tried setting RA0 as input instead of RB0 and in the main while loop checks whether RA0=1. This also works normally and when motion is detected, RA0 is set with 1 and the LED toggles.Here no interrupt logic is used for PIR output. But here as well on UART interruption the RA0 is set to high and LED toggles.
I somehow believe that whatever the case is when the UART is interrupted the LED toggles in the method which is supposed to call only when RA0 or RB0 is set.
I also see when i move my finger aroun the RB pins the interrupt is fired. Is it somekind of noise or something ?