You need the TRISA line. each bit determines input or output. so if you want ra4 as an output you need to change trisa to %11101111 also need cmcon=7 to disable the comparators. I dont have a data sheet to see what you need for adcon1 but the analog is for input only, and doesn't apply to a pin set to output. (as far as i understand) i think the cmcon and trisa lines should do the trick.