Thanks everyone.

The major problem, was a pull down button RB0, that was not working correctly.

Thanks,
Nuno