I think that your circuit reset the PIC when the noise occurs! For example, if the VDD down it can reset the PIC , by something with current consume, a rele, a servo, step motor, or a noise by power as an oscilation on Vout...With me occured this problem when was using a servo. Then I change the BOR to off and solved my problem...then I suggested it to you. I think that would be more robust to the noises, therefore reset I could be occurring when pic is in communicating with RTC.
It is a part of datasheet of 16f877A...
12.7 Brown-out Reset (BOR)
The configuration bit, BODEN, can enable or disable
the Brown-out Reset circuit. If VDD falls below VBOR
(parameter D005, about 4V) for longer than TBOR
(parameter #35, about 100μS), the brown-out situation
will reset the device. If VDD falls below VBOR for less
than TBOR, a RESET may not occur.
Once the brown-out occurs, the device will remain in
Brown-out Reset until VDD rises above VBOR. The
Power-up Timer then keeps the device in RESET for
TPWRT (parameter #33, about 72mS). If VDD should fall
below VBOR during TPWRT, the Brown-out Reset process
will restart when VDD rises above VBOR with the
Power-up Timer Reset. The Power-up Timer is always
enabled when the Brown-out Reset circuit is enabled,
regardless of the state of the PWRT configuration bit.
Good luck
Pimentel
Bookmarks