Here's a 9 instruction snippet that is inserted in the regular program loop to manage LED brightness via their common anodes (or cathodes via bit flipping). This can be used to drive transistors that switch higher currents for 7 segment displays etc. Just note your bit polarity gets inverted. So you'd need an IORLW cmd to set bits instead of the ANDLW used to clr them. Once the access rate to this code is under 2mSec the LEDs should not have visible flicker, as a 16mS DC period translates into a 62.5hz refresh rate.
EDIT: Northguy pointed out a flaw in this code...so its fixed in POST#21
Brightness; S'ware PWM (uses 3 GPRs) on a 3 bit (8 step) base, LEDdrive GPR bits 0,2 are the common anodes in this case. At about a 1.37ms prg loop speed (my app. prg) 100% DC period is 11mSec or 90Hz refresh. incf LUXCTRL,w; 100% DC timebase. GPR register andlw .7; lower 3 bits movwf LUXCTRL; range 0-7. subwf LUX_setpt,w; Brightness PWM setting, GPR register. Range = 0 (12.5%) thru 7 (100%) for dimmest to brightest. movf LEDdrive,w; buffer GPR register for common anodes avoids Read Modify Write issues. skpc andlw b'1111010'; disable active common anodes if no carry. movwf LEDport; mapped to actual pic PORT, eg #define LEDport PORTB return