Hello Zafar:
I have not yet connected an MPG through the ModBus, but have all the I/O pins on the Arduino Mega, pin #2 through #53 digital, and all of the Analog inputs tested, working just fine.
However, as I understand the ModBus functionality in Mach3, in the Serial ModBus Setup screen, there is a column for the millisecond pause for each Cfg.#, and that is a time period the scan will pause at each register waiting for an input. and another millisecond time in the upper right corner, for the "timeout" period. This seems to me, that there cannot be instantaneous response to an input in ModBus, due to the accumulated milliseconds during a scan. The Cfg# time period can be as small as 25 or 50, but it still adds up to some given period of time. I believe this is the cause of the delay in MPG response you mention.
Since the Arduino Mega has so many I/O pins, but the common parallel port has limited inputs, I think the MPG should be wired directly to the Breakout board. The BB itself can be 12 outputs, and 5 inputs, or vice versa. There are only a few kinds of inputs that need to be instant, i.e., the probe signal, the MPG, and perhaps an optical home switch, and an optical sensor spindle index.
On one of my Cubloc plc, there are the standard I/O, and then there are a couple of "High Speed" I/O pins, which are for an MPG.
I am not claiming to be a ModBus expert, and might have some some points wrong, but this seems a reasonable understanding. There is not a lot of info in the inner workings of the Serial ModBus Setup. Also the baud rate might have a different effect, say from 9600 bps, to higher settings. ModBus works perfectly fine for I/O that are not super time critical, like limit switches, spindle on/off
LED's, FRO, etc.
John
You want your limit switches to be fast as well.
Edited...... Brett