hi
if u r newbie t opic i advice u to go through the data sheet throughly dont b in hurry i worked on pic 16f877 i have code examples for that if u wish i can help u for that for 16f871 i advice to go to microchip site application notes where u can find all www.microchip.com