Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Rob West on August 03, 2017, 05:11:43 AM

Title: Suspected ‘SetUserLED’ issue when loading G code with custom M code command
Post by: Rob West on August 03, 2017, 05:11:43 AM
Can anybody please help me with this ?

I have been running my converted Morbidelli U50 for some years basically as a single spindle unit, although I had previously got all the devices working in test mode from the Mach 3 command line. I recently created some G code calling one of the extra devices and had a potentially serious problem of the drill momentary becoming active and if the Z axis was not well clear of the work at the time it would have been a crash.

Please note that this is not a Z axis issue as the Morbidelli has Pneumatic cylinder/solenoid on all devices to keep them out of the way until needed. It is a bit like the old pen plotter ‘pen up’ or ‘pen down’.

I am using ‘SetUserLED’ commands in custom ‘M code’ to drive the extended outputs on Mach 3 running a Vital controller and am having a problem when loading ‘G code’ that will be calling one of the custom ‘M code’ commands containing ‘SetUserLED’ activation (on) e.g. “SetUserLED(2022, 1)”. The device will momentary pulse on with potentially dangerous results. When running the ‘G code’ the custom ‘M code’ behaves as is desired. I have incrementally tested and ruled out all but ‘SetUserLED’ activation. Thus I do not believe this is a Vital issue, I feel it is something to do with my use of ‘SetUserLED’.

My current code looks like this

“Rem M136.m1s
Rem Drill 16 X Axis Line
message " "
code "G59 P136"
Rem - Turn on Drill - Mach 3 Output Port # 1 Pin 16
ActivateSignal (output16)
Rem - Turn on one of 6 Way Matrix - Mach 3 Output Port # 1 Pin 18 to 23
SetUserLED(2022, 1)
Rem - Turn on one of 8 Way Matrix - Mach 3 Output Port # 1 Pin 24 to 31
SetUserLED(2024, 1)
Rem - Pause to allow drill to speed up
sleep(1000)


Any help would be welcome. :)
Cheers Rob