Quote Originally Posted by skimask View Post
Why don't you post a schematic of EXACTLY what you've got...

And the code that Joe posted is different than the code that you posted...so does it work?
I have to agree w/Skimask post your schematic, It is really hard to determine what it is supposed to do. It does turn on the ports and turns them off, not sure if it does as "expected".
Some things to keep in mind,(you probably know already) All unused inputs must be terminated to VCC or VDD through resistors, in this case to ground. The RA4 is open drain so it needs a PULLUP resistor to supply +.