If the motion device (or I/O device) supports encoder interfaces, then the plug-in for that device will register one or more encoder devices with Mach4. It does this by creating a Mach4 register of type "encoder". That register can then be mapped to a DRO, and/or mapped to an MPG (this is what the Mach4 config "MPG" tab is for). You can also write Lua scripts to read (and sometimes write) that encoder register to do whatever custom thing you want. Note that you should only map an encoder to an MPG if you want to use that encoder to jog the machine. If you want to do anything else with the encoder (like, for example, create a Lua script to allow it to change the feed rate override), DO NOT map it to an MPG.
You can find out what registers your device plug-in provides by going to the "Diagnostics" menu and selecting "RegFile" (presuming that you have the "RegFile" plug-in enabled). That will show you all of the plug-ins. If you click on the "+" next to the plug-in to expand it, you will see all the registers that the plug-in exposes to Mach4.
A word of caution when mapping an encoder to an MPG. By default, if there is an MPG defined, Mach4 will use that to jog the "current" axis (determined by calls to mc.mcMpgSetAxis(), and set to the X axis by default on startup). Whenever Mach4 is enabled, changes in the encoder count will cause motion based on the change in encoder counts. If the encoder is configured to reset it's count to zero once per revolution, that will cause *LOTS* of motion as Mach4 will see the count go from, say, 99 to 0 for a 100 count encoder. That looks like a huge jog request. Likewise, if you change the encoder value via a DRO while Mach4 is enabled, that will also cause Mach4 to try and jog the current axis.
The plug-in determines whether to allow DRO edits to actually change the encoder count. I had to explicitly add code to the PMDX-SmartBOB plug-in to allow that feature. I have no idea if any other plug-ins provide this functionality. Likewise I also added code to prevent changes to the encoder count from the DRO if the encoder is mapped to an MPG *AND* if Mach4 is enabled (see caution above).
Bob