TRISB1 needs to be set to 1 to configure RB1 (RX) as an input. I'm not sure what the default is, so it may be ok.
You need to clear the receive interrupt flag (RCIF) by reading the receive register (RCREG). In addition, since the receive register is doubled-buffered, you may need to read it more than once.
So your interrupt routine needs to look more like this:
extern interrupt isr(void)
{
while (RCIF)
{
char ch;
RB5 = 1;
ch = RCREG; // normally would go into an array and increment a counter
}
}
I don't know if that is your only problem, since you indicate you are not getting into the interrupt routine at all. But the above is the correct way to read the characters out of the receive buffer.
======================================
EDIT:
Don't know if this will help or not, but in this post, before enabling interrupts, the code clears out the FIFO first. (Their code also clears out the RCIF flag, but since it is readonly on your chip, that isn't needed.)
ch = RCREG; // clear FIFO
ch = RCREG;
ch = RCREG;
// then enable interruupts ...
How accurate does this 30 day period have to be? 30 days is about 2.5 million seconds, with a crystal accuracy of 20 ppm you might have a one minute error after 1 month.
If a one minute error is unacceptable you could use a temperature controlled oscillator or a better crystal, like 5 ppm. If external aid is allowed you could use the signal of a DCF77 receiver (Europe, WWVB for North-America). These will give you a tick per second with atomic clock precision. All you have to do is count pulses. Note that DCF77 has only 59 pulses per minute, the omitted pulse indicates the start of a new minute. If you take this into account your 30 day period has elapsed after 2 548 800 pulses (59 \$\times\$ 60 \$\times\$ 24 \$\times\$ 30).
If the PIC has to do it all by itself that shouldn't be a problem either. Clock at 32768 Hz and program a timer to give an interrupt after 32768 clock cycles, that's one second. Count 2 592 000 interrupts (60 \$\times\$ 60 \$\times\$ 24 \$\times\$ 30).
In a month a lot can happen, and you probably want a battery backup in case there's a power outage. If you use the atomic clock signal you can also decode the time code after each minute pulse and compare date and time with your target time. In that case power outages don't even matter.
edit
You don't mention which PIC you're using, and without any practical experience with them I know there is a lot of them. I'll pick the PIC10F200 because as I understand it it's (one of the) least capable PICs, just having one 8-bit timer/counter.
The timer/counter can be clocked internally by the clock/4, and has a selectable prescaler. If you use a 32.768 kHz crystal for the clock, then clock/4 = 8192 Hz. Set the prescaler to \$\div\$32 and the 8-bit timer/counter will overflow once every second.
edit 2 (re Olin's comment)
Olin points out that the PIC10F200 only has an internal oscillator. That won't have crystal accuracy, but you can clock the timer from an external clock. Connect the output of the 32.768 kHz oscillator to the T0CKI input and set the prescaler to \$\div\$128. Then the 8-bit timer/counter will overflow once every second. As I understand it there's no overflow interrupt, so you'll have to detect this by comparing the timer value to 0x00.
edit 3 (re your comment on accuracy)
Allowing a two day error in one month is what we call very low accuracy. That 6.7%. The internal oscillator is calibrated to 1% at 25°C, 2% over the full range. So if you want you can use the internal oscillator, then you don't need the external 32.768kHz crystal. The oscillator is tuned to 4MHz, \$\div\$4 gives you 1MHz at the timer's prescaler. If you set the prescaler to \$\div\$64 then the 8-bit timer is clocked at 15625Hz. Count 61 overflows for every second, even if you ignore the remainder you still get 0.06% accuracy.
Best Answer
The PIC16F877A pins can source or sink no more than 25 mA.
It may be possible to damage the device by drawing excess current from an IO pin. for example by driving a LED without a current limiting resistor.