Hi. The PIC16F877A has RA0 to RA5, doesn't go to RA7, see attached pinout diagram. Here is a link to the data sheet:
https://www.electro-tech-online.com/custompdfs/2010/07/39582b.pdf
If you run motors from this you'll have to use the PIC to switch something like a transistor or driver chip, like the ULN2803A. The ULN chip has eight outputs, each capable of driving up to 500 mA, but not all at of them at once or the chip fries.
https://www.st.com/stonline/products/literature/ds/1536/uln2805a.pdf
This should be suitable for running small DC motors, even steppers. Servo motors can be driven directly from the PIC output pins. In all these situations you have to be sure to have adequate power to drive the motors without bringing the regulator's output so low that the PIC goes into brownout reset.
If you want to drive a DC motor both forwards and backwards you'll have to use a half-bridge circuit, usually built from FETs or ICs, like the L293.
https://www.st.com/stonline/books/pdf/docs/1328.pdf
This data sheet shows how to hook DC motors up in some different configurations.
And there are one-board solutions that do it all, like this Nano Driver Board:
**broken link removed**
This $25 board has a PIC16F88 18-pin controller as its brains. It has servo headers that can double as I/O, that is, analog (ADCs) or digital. It has all the parts above, including four FETs that can drive 9.2 Amps (!) _EACH_ !! And you have to purchase the $15 USB programmer at the same time. That's just $40 before shipping. Read the data sheet, available from the link above. One big plus is that this is a bootloader, with a free BASIC, so its as easy to use as you will ever find. Download the BASIC with its modern graphical IDE (Integrated Design Environment), check out the numerous demo codes for different motors, and you're off and running.
Hope that helped.
Take care.
kenjj