Craig
OK. I tested the macros on my CSMIO system.
I started Mach4, left it disabled, and opened m201 in the debugger. Running the code, the M0 Enable LED turned on, and I could tell from the locking of the X axis motor that the CSMIO output had also been activated. So far so good. Next I ran m200 in the debugger. the M0 Enable LED turned off as expected, but contrary to my expectations the CSMIO output remained active, i.e. the X axis motor was still energised.
Pressing Enable/Disable caused the motor to lock and unlock, as expected. I then ran the m201 macro again in the debugger, This time the M0 Enable LED came on, but the CSMIO output did not, i.e. the motor remained unenergised. Enabling Mach4 and running the m200 macro in the debugger similarly produced no response from the CSMIO, i.e. in this scenario the M0 Enable LED turned off but the motor remained energised.
Finally I enabled Mach4 and ran the 2 macros from the MDI window. Neither had any effect, either on the LED or on the motor itself.
Though the results do not entirely echo those using the simulator, the overall conclusion remains that the Enable outputs cannot be programmatically changed using API calls from user scripts. Your current approach ingvolving a second output and external logic would therefore seem to be the way ahead if this type of functionality is needed.
Note that my system does not exactly echo that of the op. I have the CSMIO/IP-A with the latest v3.08 (beta) plugin. I couldn't do what the op hopes to achieve, even if I wanted to, as the IP-A is closed loop and so would ssurely generate a PID error as soon as the motor position failed to match that expected by Mach.
Allan