I am sorry Richar for having posted the file that is not the final one:
please change the following:

A VAR PORTD.0 ' encoder A PHASE
shAll be:
A VAR PORTB.0

This is the interrupt input !

I would be happy to know ...
Thanks and regards,
Ambrogio