I building a little thingie that are going to use alot of pins, and since some has to be analog, some CCP (PWM) and so on I really had to do some thinking of what pin to use where.

Well, then I choosed RA0 RA1 and RA2 for the three LED's, fine, in the beginning I just used RA0 and RA1 and no problem, then I started to use RA2.. didnt work.

It's nothing complicated, I just set all pins low in the beginning of the code, and just use:

high porta.0
high porta.2

..and so later on.

If I look at the datasheet pin 4 on 16F877A is:

RA2/AN2/Vref/CVref


..and pin 2 and 3 only is RA0/AN0 and RA1/AN1

So, Vref or CVref seem to be the problem, wise of my earlier mistakes I started with disabling the comparators with "CMCON = 7", didn't help

I tried to understand what do by reading the microchip dopcumentation, but no..

I guess that its something else I have to disable to be able to use RA2 as an digital IO-pin ?

anyone have an idea ?