Afraid I dont know enough about the G540 to help with that. What I would do though is start a basic profile, only have one axis enabled, E-Stop configured as active low. Unhook the cable from the G540 then put a volt meter on the Dir pin and Gnd pin of the cable and jog the axis back and forth to see if voltage corresponds, if it does you know the port is at least the correct address and that pin works. You could then try the other axis enabled if you wished.
If all that works then you know the problem is the way the G540 is set up is the problem, whether its wiring or config in Mach.
Maybe someone who is familiar with the G540 will be able to help more on that side of things.
Hood