3521
Mach4 General Discussion / Re: Mach 4 Reference sequence Question
« on: November 11, 2018, 06:24:03 PM »
Hi,
the real strength of Mach4 is the facility with which it can be programmed to do such things. The greatest weakness of Mach4
is that you have to program it to do unusual things.
I must be said that Mach4 as it is doesn't require the feature you want.....it can machine parts in absence of that feature no trouble.
If you want some particular feature then you will have to program it and therefore learn about Lua and Mach's modular structure.
There is a learning curve. Remember if you don't like it.....the reason you're doing it is because you want some specific thing not
otherwise provided for.
Having stood on my soapbox and possibly scared you; what you want to do is easy.
How much do you know about Mach's structure? In particular can you open the Screen Editor and navigate to the Screen Load script,
the PLC script etc? If this is unfamiliar to you there are some videos covering it released by NFS in recent months. Unfortunately
the re-direct feature of the forum is on the blink so I can't link you to it.
In this case you need to put a few lines of code in the PLC script. The PLC script is somewhat analogous to the macro pump in Mach3.
The PLC script runs every few milliseconds. What you what it to do is ask the question 'is the machine referenced....if so turn on an output....if not
turn the output off'. This will run hundreds of times a second and so the output will reflect the state of the machine virtually continuously.
For the purpose of writing code I would recommend opening the Zero-Brane editor and creating a new file within your profile...something like
/TempWorkFile. It gives you the chance to write the code and have the Lua compiler compile the code checking for errors. You can also use the debugger
to run the code for test purposes. Once you have code that you think is going to work THEN copy and paste it into your PLC script.
I'll write some code and post it soon.
Craig
the real strength of Mach4 is the facility with which it can be programmed to do such things. The greatest weakness of Mach4
is that you have to program it to do unusual things.
I must be said that Mach4 as it is doesn't require the feature you want.....it can machine parts in absence of that feature no trouble.
If you want some particular feature then you will have to program it and therefore learn about Lua and Mach's modular structure.
There is a learning curve. Remember if you don't like it.....the reason you're doing it is because you want some specific thing not
otherwise provided for.
Having stood on my soapbox and possibly scared you; what you want to do is easy.
How much do you know about Mach's structure? In particular can you open the Screen Editor and navigate to the Screen Load script,
the PLC script etc? If this is unfamiliar to you there are some videos covering it released by NFS in recent months. Unfortunately
the re-direct feature of the forum is on the blink so I can't link you to it.
In this case you need to put a few lines of code in the PLC script. The PLC script is somewhat analogous to the macro pump in Mach3.
The PLC script runs every few milliseconds. What you what it to do is ask the question 'is the machine referenced....if so turn on an output....if not
turn the output off'. This will run hundreds of times a second and so the output will reflect the state of the machine virtually continuously.
For the purpose of writing code I would recommend opening the Zero-Brane editor and creating a new file within your profile...something like
/TempWorkFile. It gives you the chance to write the code and have the Lua compiler compile the code checking for errors. You can also use the debugger
to run the code for test purposes. Once you have code that you think is going to work THEN copy and paste it into your PLC script.
I'll write some code and post it soon.
Craig