I'm having a bit of trouble understanding your setup. But to turn the spindle on and off via Mach3 through the G540, you need to have the G540 control a relay that turns the power to the spindle on/off
Once you have set it up you should be able to use the M3/M4 and M5 words to control the spindle from GCode.
Cheers,
Peter.