If your router is a bought producct rather than a home built one then then ask the vendor if they have an xml for Mach3 (or Mach2 if that is what you use), If they do then all you have to do is place the xml on the Mach3 folder and start Mach and all the ports and pins will be set.If not then you will have to set them manually but the vendor should be able to supply pinouts to help you.
Hood