Hi mamadooo,
You should be able, just make sure that the encoder's output signals comply with the voltage level complies are TTL, LVTTL or CMOS.
It's also possible to read the signal from the AI in which case you'll need to consider the maximum sampling rate and voltage level.
Regards,
PedroR