I'm not sure if you have already done in a part of your code that has not been posted,

PortA 4:0 are analog inputs by default, set them to digital!