you need to buy something like this.
then you take it apart and find out how its wired.
Usually the side button enables the MPG encoder - for safety.
and then you have to connect all wires to your mesa card or whatever interface are you using.
and make hal file for it:
linuxcnc.org/docs/html/examples/mpg.html