I just found out that the ''working code'' is not working so great. I seem to always read channel 9 (pin PB1) properly, but channel 2 (pin PA2) sometimes return values around 26-28 and sometime it returns values around 2888-2890, but the correct value is around 550. Does anybody know what's wrong?