What are you wanting to do?, the 16F877 doesn't have any battery backup capability - but you could quite easily power the device as normal from a battery. You obviously need to design the entire circuit for low power consumption though, if running off a mains supply you don't normally bother.