Hello Guest it is March 31, 2026, 10:30:04 AM

Recent Posts

Pages: « 1 2 3 4 5 6 7 8 9 10
91
MachPro General Discussion / Re: PLC Scripts
« Last post by paul.stephens on March 09, 2026, 09:48:41 AM »
In MachPro there's actually already a built in method for handling Light Stacks inside of Configure → Control → Settings. Alternatively you can also handle it through the GMS plugin as well.
If you prefer the lua code route, under the Service → Maintenance tabs, we have a Compile Scripts button that should apply your custom programming and most changes, so you no longer have to power cycle Mach.

In an ideal sense, we prefer to not have custom programming on the newer software as it becomes a nightmare to support. We are working on documentation on how to handle all these things.
92
Hi Craig

Thanks very much for takig the time to reply.  I have learned alot from reading your posts on this forum, so thanks for that too.  I'm now thinking that the issue might be that the profile hasnt been properly generated by the Pokeys plugin.  My macros folder for Johnny 5 is empty but a profile that I made years ago for some preliminary testing (this DIY build has been on and off again for years) has an m6.mcc, m6.mcs and mclua.mcc in it's macros folder, which seems like it could be significant.  I might try and make a new profile and see what happens. I will also do as you suggest although I think I did already try making an m100 and nothing happened with that either. I dont want to edit m6 I just want mach to run it, which it currently wont. You are absolutely correct about AI.  I was using Claude but quickly found it's limits. 
Thanks again for your help 
93
Hi,
I'm no expert in Mach4 Lua coding but I've never written 'luafunction m6()', but rather just 'function m6()'.

function m100()               rather than:

luafunction m100()


Second thing I'd try is NOT use m6. m6 is reserved for tool change and in all probability Mach4 already has some rudimentary m6() code built-in. All you are doing is overwriting it.

May I suggest try the same test code, but call it m(100). I follow the old Mach3 rule, all user written scripts should be m100 or higher.
If you write your own m6 for instance then YOU MUST ASSUME RESPONSIBILITY for ALL the required functionality of an m6. If there is something that Mach expects or requires from
an m6 and you overwrite the supplied m6 then your code must include it.

My guess is that you are using chatGPT or similar to code Lua.......good luck, you get good looking code, just that it does not work! There's no substitute for rolling up your sleeves and learning this stuff
for yourself. I cannot ever see a time where AI is going to mean that humans do not have to learn. Learning is a fundamental human trait.

Craig
94
MachPro General Discussion / Re: PLC Scripts
« Last post by tbadger on March 07, 2026, 05:02:03 PM »
Okay, might just be user error. I did not restart Mach Pro after updating the script. On restarting, it does seem to be working as expected.
95
MachPro General Discussion / PLC Scripts
« Last post by tbadger on March 07, 2026, 04:45:09 PM »
I'm wanting to add a PLC script that calls a module for Mach status lighting. In Mach 4, that seemed pretty straight forward. I'm not a seasoned coder, so there is little that is intuitive about LUA coding for me.  In Mach Pro, the "new" PLC Script just has the following:


Code: [Select]
if m.CommonPLCScript ~= nil then
m.CommonPLCScript()
end

I want to insert this code into the PLC Script, so that it calls the towerscript.lua module.

Code: [Select]
if towerscript == nil then
towerscript = require "towerscript" -- Load's towerscript.lua from a path. probably C:\Mach4\Modules
end
towerscript.PLCScript()

I tried just pasting it at the end of the previous lines, but that did not seem to work. I've found little information in the documentation that would guide me in the right direction.


96
General Mach Discussion / UC100 USB motion controller
« Last post by kolias on March 07, 2026, 04:03:17 PM »
I'm using UC100 USB with Windows10 PRO for my 3 axis CNC. My desktop PC is a dedicated PC just for my CNC and I don't want MS updates. If I disable my wireless connection would the US100 work properly?

Thanks

97
Brains Development / Modbus Input Holding Not Reading in Brains
« Last post by BSRHAANN on March 07, 2026, 03:54:51 PM »
Set up Mudbus RTU to Servo Drive to read and write holding registers.  I can run "Test Modbus" without any issues, all requested input and outputs read and write correctly.  I have setup my Modbus configuration using the same parameters.  Created and Enabled a simple Brain that compares the CFG(0) Modbus input to turn off/on an output but I only get 0.0000 in my Modbus Reading.  Have also tried similer ouput (CFG)'s and Brains, it only wants to send 0.0000.  Any ideas what I am missing??? 

Thank You,

Brandon
98
Hi all,
It's my first post, so please accept my apologies if I should have posted this somewhere else.  I have a custom 5-axis router running Mach4 4.2.0.4300 with a PoKeys57CNC motion controller. My profile (johnny5) was created using the PoKeys setup wizard and uses the wx6 screenset.
I am unable to get any macros to execute. I have tried M6 and M30. Both are silent — no errors, no popups, nothing. The macro files are in C:\Mach4Hobby\Profiles\johnny5\Macros\ and are correctly structured Lua scripts following the standard format:

luafunction m6()
    inst = mc.mcGetInstance()
    mc.mcCntlSetLastError(inst, "test")
end

if (mc.mcInEditor() == 1) then
    m6()
end

Files are saved with ANSI encoding. ZeroBrane compiles them with no errors. However no .mcc files are ever created in the macros folder after restarting Mach4.
The diagnostic log shows M30's internal rewind firing 125ms after cycle start with no macro involvement at all — the macro is simply never called.
The johnny5 profile folder does not contain a Modules subfolder. The default Mach4Mill profile does not appear to have .mcc files either.
Doe anyone know what is preventing macro compilation and execution in this profile please? Is there a configuration step I am missing when setting up a new profile from scratch via the PoKeys wizard?
Thanks very much in advance for reading, and giving this some thought.
99
I have just bought a 3 wire (5v, ground, signal) touch probe, which I plan to connect to a free pin on my CNC breakout board. I want to configure the probe to find the edge in X and Y of my workpiece or my workpiece holder (back left as you look into the machine). Can anyone recommend and post a simple script to me?
100
Mach4 General Discussion / Re: Servo ready input ess , howto block cyclestart
« Last post by joeaverage on March 04, 2026, 04:55:41 PM »
Hi,
begs the question.......why?

I use 750W Delta B2 servos on my machine and have done for five years. In five years of operation I've never had a situation that I require the <CycleStart> need be inhibited.

Each servo has a fault output that goes to a distinct Mach4 input (via the ESS/breakout board) and one one (or more) fault inputs will cause the machine to Estop. I've had fewer than
half a dozen occasions over five years where a servo will fault, either following error, over voltage, over current or anything else. However, whenevr such a fault does occur then the machine
stops and will not accept a <CylceStart> anyway.

All servos (up to six for six axes) are enabled in common. Thus if you deactivate just one output from the ESS then ALL servos will stop. Thus if you had a condition that required
motion inhibit then just release the Enable signal. That would stop machine motion but the Gcode could advance. Thus if you hit <CycleStart> Mach would carry on as if the machine were
running normally ie consuming Gcode, but all the axes would not move as each servo  is disabled. Has a similar result.

I do have a Motion Inhibit signal, but its activated by the spindle. If the spindle is commanded to start after two seconds (or so) the spindle monitor board checks to ensure the spindle is rotating,
i.e. accelerating. If the spindle is not accelerating, say a fault, or VFD fault, or similar then I do not want the machine to start cutting with a spindle that is not spinning. This fault condition is detected by my
spindle monitor board and signals Mach 'Motion Inhibit'    and stops all motion until the fault can be cleared.

The question is 'are you sure you need it?' I have not ever needed <CycleStart> to be inhibited, but have made the effort to have the spindle monitor board inhibit motion rather
than burying a non-spinning tool into material.

Craig
Pages: « 1 2 3 4 5 6 7 8 9 10