Due with Tamagawa TS5300 digital encoder used to control thread turning

Thanks to this forum I managed to get the encoder working with the Due.

Can you share us the wiring diagram of encoder with Arduino Due board. Also provide me the code. Thanks in advance.